Subject: | File descriptor leak in 1.20? |
Date: | Thu, 23 Jun 2016 11:27:07 -0700 |
To: | bug-AnyEvent-Filesys-Notify [...] rt.cpan.org |
From: | Dave Hayes <dave [...] jetcafe.org> |
Apparently, the following code demonstrates a file descriptor leak in
1.20. Is there something I'm not understanding here? :)
#!/usr/local/bin/perl
BEGIN { use lib qw(lib); }
use EV;
use AnyEvent;
use AnyEvent::Filesys::Notify;
use AnyEvent::Filesys::Notify::Role::KQueue;
$AnyEvent::Filesys::Notify::Role::KQueue::WARN_FILEHANDLE_LIMIT = 1;
mkdir("/tmp/foobar");
my $q_watcher = AnyEvent::Filesys::Notify->new(
backend => 'KQueue',
dirs => [ "/tmp/foobar"],
cb => sub {
foreach my $e (@_) {
my $path = $e->path;
my $type = $e->type;
return unless ($type eq 'created' && -f $path);
warn "Removing '$path'\n";
unlink($path);
}
},
);
my $stresser = AnyEvent->timer(
after => 1,
interval => 0.25,
cb => sub {
my $path = "/tmp/foobar/stress";
if (open(S,">$path")) {
print S "\n";
close(S);
warn "Touching '$path'\n";
} else {
warn "Can't open $path: $!\n";
}
},
);
EV::run;
die "Shouldn't ever get here\n";
--
Dave Hayes - Consultant - Altadena CA, USA - dave@jetcafe.org
Show quoted text
>>>> *The opinions expressed above are entirely my own* <<<<
Our greatest fears are shadows of things that don't exist.