Perl Linux::Inotify2 - can't respond to events anymore
Posted
by
alcy
on Stack Overflow
See other posts from Stack Overflow
or by alcy
Published on 2011-02-12T07:08:58Z
Indexed on
2011/02/12
7:25 UTC
Read the original article
Hit count: 138
I am getting some really weird behavior when using Linux::Inotify2 module for watching a directory for any newly created files.
I had made a test script to see how it worked, and once that was done, I went on to incorporating its usage in the other scripts, in which it didn't work. Then, when I tried my earlier test script again to find some information, strangely that stopped working as well. It hasn't worked since then. There were no package/distro upgrades during that time.
The problem is that it has stopped responding to events. Here's the test script:
#!/usr/bin/perl
use strict;
use warnings;
use Linux::Inotify2;
my $inotify = new Linux::Inotify2 or die "unable to create new inotify object: $!";
my $dir = "/my/dir";
$inotify->watch($dir, IN_CREATE, sub {
my $e = shift;
print $e->fullname;
}) or die " Can't watch $!";
1 while $inotify->poll;
A strace on the running script kills the script. Otherwise when strace is used when starting the script, then it does seem to read the new events, but there's no response to those events. Any suggestions for debugging this further ?
© Stack Overflow or respective owner