Skip Menu |

This queue is for tickets about the IPC-Run CPAN distribution.

Report information
The Basics
Id: 68859
Status: resolved
Priority: 0/
Queue: IPC-Run

People
Owner: Nobody in particular
Requestors: pauwel.coppieters [...] hp.com
Cc: cpanrt [...] edsantiago.com
AdminCc:

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



Subject: run hangs in select call on solaris platform
Date: Thu, 16 Jun 2011 10:23:27 +0000
To: "bug-IPC-Run [...] rt.cpan.org" <bug-IPC-Run [...] rt.cpan.org>
From: "Coppieters, Pauwel" <pauwel.coppieters [...] hp.com>
Hello, I found the following behaviour for IPC::RUN-0:89 on SunOS 5.10 sun4v sparc SUNW,Sun-Fire-T200 perl5 (revision 5 version 8 subversion 4) In the module RUN.pm you have the piece of code near line 3030: my $nfound; unless ( Win32_MODE ) { $nfound = select( $self->{ROUT} = $self->{RIN}, $self->{WOUT} = $self->{WIN}, $self->{EOUT} = $self->{EIN}, $timeout ); } else { If in RIN, WIN and EIN there are no file descriptors at all, the select returns after $timeout seconds with $nfound = 0. This is correct, but the timeout is annoying. I replaced this code with : my $bitsr = unpack("b*", $self->{RIN}); my $bitsw = unpack("b*", $self->{WIN}); my $bitse = unpack("b*", $self->{EIN}); if ($bitsr eq '0000000000000000' && $bitsw eq '00000000' && $bitse eq '') { $nfound = select( $self->{ROUT} = $self->{RIN}, $self->{WOUT} = $self->{WIN}, $self->{EOUT} = $self->{EIN}, 1 ); } else { $nfound = select( $self->{ROUT} = $self->{RIN}, $self->{WOUT} = $self->{WIN}, $self->{EOUT} = $self->{EIN}, $timeout); } Not very sophisticated, but for the time being it works. Kind regards, Pauwel
I've been struggling with a similar problem, but I have a different solution. The symptom I've been seeing is sporadic hangs with: run \@cmd, \undef, '>&', \$stdout, timeout(3600); ...when \@cmd exits quickly. I don't know the specifics, and don't have a consistent reproducer, but it smells like a race condition. _select_loop() ends up in select() with no FDs ("selected ------------ "), which means the only way out is via timeout. The patch below (against 0.89 but also applies on 0.92) is in response to this header comment in pumpable(): ## Undocumented feature (don't depend on it outside this module): ## returns -1 if we have I/O channels open, or >0 if no I/O channels ## open, but we have kids running. This allows the select loop ## to poll for child exit. That may have been true in a previous incarnation, but no longer is. My patch makes this comment reflect truth, and the >0 return value triggers code in _select_loop() that shortens the select timeout to sub-second values. That's good enough for my use. Note that with this change, the "> 0" to "!= 0" change applied as a workaround for RT 57277 can probably be reverted back to "> 0". I haven't looked closely enough, though. My apologies for not offering a test case. If I could find a way to reproduce this behavior, I would gladly do so. The only thing I have to offer is that my test setup has been running for 3 hours with no hangs, whereas before I would expect a hang within one hour.
Subject: Run.pm.diff
--- /usr/share/perl5/vendor_perl/IPC/Run.pm 2010-03-31 22:30:34.000000000 -0600 +++ /tmp/Run.pm 2012-10-18 13:38:56.109186969 -0600 @@ -3331,6 +3331,8 @@ $self->reap_nb; return 0 unless $self->_running_kids; + return 1 if ! @{$self->{PIPES}}; ## kids pending, no pipes waiting + return -1; ## There are pipes waiting }
Ticket migrated to github as https://github.com/toddr/IPC-Run/issues/90