pyinotify issue

A

AndreH

Good day,

I just installed pyinotify on my gentoo box.

When I test the library through "pyinotify.pv -v /tmp" under root,
everything works great, but when I try the same thing under my local
user account, I receive the following error:
Error: cannot watch . (WD=-1)

Not very helpful. I've tried VERBOSE=True mode, but it doens't provide
any additional information.

I also tried it for a directory in my home folder just to be sure it's
not a permission problem, but no luck.

Any ideas?

Regards,
Andre
 
A

AndreH

Good day,

I just installed pyinotify on my gentoo box.

When I test the library through "pyinotify.pv -v /tmp" under root,
everything works great, but when I try the same thing under my local
user account, I receive the following error:
Error: cannot watch . (WD=-1)

Not very helpful. I've tried VERBOSE=True mode, but it doens't provide
any additional information.

I also tried it for a directory in my home folder just to be sure it's
not a permission problem, but no luck.

Any ideas?

Regards,
Andre

Ok I ended up solving my problem.

pyinotify is just a wrapper for the c lib, inotif.h. Installing the
inotify-tools package allows one to do better troubleshooting.

First, my kernel version was too old and did not allow inotify to be
executed at user-level. I bumped my kernel up to 2.6.24 and enabled
the user-level execution flag.

Then pyinotify worked once and failed for all consecutive retries.
inotifwatch said that my "maximum number of user watches" was maxed
out and that I should increase it under /proc/sys/fs/inotify/
max_user_watches.

Something must be wrong, since the max_user_watches was set to 8192. I
played around with this setting (sysctl -w
fs.inotify.max_user_watches=16843), pyinotify.py and inotifywatch, and
finally came the conclusion that pyinotify 0.7.0 was buggy. I got hold
of 0.7.1 which seems to have fixed this problem. Hopefully, I'm not
speaking too soon.
 
A

AndreH

Ok I ended up solving my problem.

pyinotify is just a wrapper for the c lib, inotif.h. Installing the
inotify-tools package allows one to do better troubleshooting.

First, my kernel version was too old and did not allow inotify to be
executed at user-level. I bumped my kernel up to 2.6.24 and enabled
the user-level execution flag.

Then pyinotify worked once and failed for all consecutive retries.
inotifwatch said that my "maximum number of user watches" was maxed
out and that I should increase it under /proc/sys/fs/inotify/
max_user_watches.

Something must be wrong, since the max_user_watches was set to 8192. I
played around with this setting (sysctl -w
fs.inotify.max_user_watches=16843), pyinotify.py and inotifywatch, and
finally came the conclusion that pyinotify 0.7.0 was buggy. I got hold
of 0.7.1 which seems to have fixed this problem. Hopefully, I'm not
speaking too soon.

I spoke too soon.

pyinotify still seems to max out my number of user watches... I get
this message when I run inotifywatch after a pyinotify operation:

Establishing watches...
Failed to watch .; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via `/
proc/sys/fs/inotify/max_user_watches'.


Strange. I'll keep on troubleshooting.
 
S

Sebastian \lunar\ Wiesner

AndreH said:
I spoke too soon.

pyinotify still seems to max out my number of user watches... I get
this message when I run inotifywatch after a pyinotify operation:

Establishing watches...
Failed to watch .; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via `/
proc/sys/fs/inotify/max_user_watches'.

inotify itself doesn't have support for recursive watches. If you are
recursively watching a single directory, each subdirectory is added as
single, separate watch. If you're watching large directories for changes,
it may well be, that there is no bug in inotify, but you're really hitting
the watch limit (which is one of the reasons, why stuff like locate can't
be implemented on top of the inotify mechanism). Still, it sounds very
unlikely, that there are directories containing more than 8192
sub-directories, but did you consider this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top