Guard: Pas d'espace disponible sur l'appareil - Échec de la lecture...

Créé le 22 janv. 2012  ·  18Commentaires  ·  Source: guard/guard

Fichier de garde :

guard 'rspec', :version => 2, :cli => "--color --format nested" do
  watch(%r{^spec/.+_spec\.rb})
  watch(%r{^lib/(.+)\.rb})     { |m| "spec/#{m[1]}_spec.rb" }
end

Gemfile

group :development do
  gem 'guard'
  gem 'libnotify'
  gem 'guard-rspec'
  gem 'rb-readline'
end

Environnement

  • Linux 2.6.32-5-amd64
  • ruby 1.8.7 (2011-06-30 patchlevel 352)

    Erreur

Lorsque j'exécute guard start je vois un message libnotify avec le rapport, puis guard se bloque avec l'erreur suivante :

//home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
    from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19


Est-ce qu'il essaie de regarder les fichiers git ? Est-ce que je rate quelque chose ?

Commentaire le plus utile

Essayez d'augmenter le nombre max_user_watches pour inotify. Il est défini par défaut sur 8192. Je l'ai déplacé à 100k et tout va bien.

cat /proc/sys/fs/inotify/max_user_watches

echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches

Pour augmenter max_user_watches au démarrage, éditez /etc/sysctl.conf et ajoutez fs.inotify.max_user_watches=100000 ou corrigez fs.inotify.max_user_watches= à 100000.

Ne me remerciez pas, remerciez ce gars -> http://blog.sorah.jp/2012/01/24/inotify-limitation

Tous les 18 commentaires

Cela pourrait arriver lorsqu'il y a trop de fichiers à regarder dans votre dossier, vous pouvez ignorer certains chemins avec la méthode ignore_paths (plus d'informations à ce sujet dans le README )

J'ai essayé d'utiliser ignore_paths '.git' cela n'a eu aucun effet.

Je n'ai que 93 fichiers dans le projet :

find . | grep -v '.git'  | wc -l
93

C'est bizarre, essayez de demander à lib d'informer les gars.

Juste pour info, .git est déjà ignoré par défaut : https://github.com/guard/guard/blob/master/lib/guard/listener.rb#L19

Des nouvelles?

Non. Je vais essayer de l'exécuter sur une autre machine.

Hm.. À mon travail, sur un autre PC, le même projet fonctionne bien avec guard.. Sur les deux PC, j'utilise Debian Squeeze.

J'ai un problème similaire avec un gros répertoire que j'ai ignoré en utilisant ignore_paths. Il insiste pour se plaindre d'avoir « Échec de la surveillance » d'un fichier dans le répertoire ignoré.

Les chemins ne sont ignorés qu'au niveau Guard mais pas avec rb-inotify donc utiliser ignore_paths n'est pas utile ici. Pour résoudre votre problème, je pense que nous avons besoin d'une option ignore_paths dans rb-inotify . @nex3 pensez -vous que ce serait possible?

Il ne semble pas y avoir de moyen d'ignorer sélectivement les chemins dans l'interface inotify sous-jacente.

J'ai retiré le répertoire Monster de l'arborescence du projet pour le moment. Merci d'avoir essayé.

J'ai supprimé le répertoire .git et cela fonctionne pour moi aussi. Mais il y a peut-être mieux :)

Essayez d'augmenter le nombre max_user_watches pour inotify. Il est défini par défaut sur 8192. Je l'ai déplacé à 100k et tout va bien.

cat /proc/sys/fs/inotify/max_user_watches

echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches

Pour augmenter max_user_watches au démarrage, éditez /etc/sysctl.conf et ajoutez fs.inotify.max_user_watches=100000 ou corrigez fs.inotify.max_user_watches= à 100000.

Ne me remerciez pas, remerciez ce gars -> http://blog.sorah.jp/2012/01/24/inotify-limitation

@jhirn Joli lien, merci de le partager ! /cc @Maher4Ever

@thibaudgg Je pense que c'est en effet une bonne idée d'attraper cette exception et d'afficher un lien vers une (page wiki ?) ou quelque chose sur le dépôt Listen pour aider les utilisateurs. Doit-on ajouter la première page wiki à Écouter ? :)

Faites-le, mais assurez-vous de créditer github.com/sorah et pas moi. =)

@Maher4Ever yeah +1 pour un lien vers notre première page wiki Listen !

@jhirn , bonne trouvaille !
@thibaudgg , merci pour le soutien.

Cette page vous a été utile?
0 / 5 - 0 notes

Questions connexes

lastobelus picture lastobelus  ·  5Commentaires

tomrossi7 picture tomrossi7  ·  6Commentaires

mockdeep picture mockdeep  ·  23Commentaires

Odaeus picture Odaeus  ·  21Commentaires

bgentry picture bgentry  ·  10Commentaires