Skip Menu |

This queue is for tickets about the AnyEvent-Subprocess CPAN distribution.

Report information
The Basics
Id: 86579
Status: new
Priority: 0/
Queue: AnyEvent-Subprocess

Owner: Nobody in particular
Requestors: rod.taylor [...]

Bug Information
Severity: Important
Broken in: 1.102912
Fixed in: (no value)

Subject: Open Filehandle Growth
Download (untitled) / with headers
text/plain 634b
When using StandardHandles the coder must be careful to close the delegates themselves otherwise there will be infinite open handle growth. Without the "close_fh" call on STDIN, this script will eventually build up tens of thousands of open file handles despite not touching stdin itself. I had expected that when the AnyEvent::Subprocess object went out of scope that it would close the handles themselves. I am not actually touching STDIN myself, just capturing STDOUT so I was a surprised that the stdin delegate leaked. Please see attached sample script. It leaks handles on both FreeBSD 9.1 and Ubuntu with Linux 3.8 kernels.
text/x-perl 617b
#!/usr/bin/perl use v5.14.2; use AnyEvent::Subprocess; for my $i (0 .. 100_000) { do_work(); } sub do_work { my $job = AnyEvent::Subprocess->new( delegates => [ 'CompletionCondvar', 'StandardHandles' ], code => sub { exit 0; } ); my $run = $job->run; my $condvar = $run->delegate('completion_condvar'); my $done = $condvar->recv; # Close delegate handles # # Comment this out and the process will grow an infinite number of open # file handles. # $run->delegate('stdin')->handle->on_drain( sub { $_[0]->close_fh } ); return; }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to