Skip Menu |

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

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

People
Owner: RSOD [...] cpan.org
Requestors: ilya [...] martynov.org
Cc:
AdminCc:

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



Subject: IPC::Run fails with "Interrupted system call" error
Hi, I have a problem using IPC::Run in my quite big Perl application. After some changes in it IPC::Run started to fail with "Interrupted system call in select" error. I tracked it down to line croak "$! in select" if $nfound < 0 ; in IPC::Run::_select_loop(). As I understand from select man page "Interrupted system call" (EINTR) is a normal condition and it is not correct to croak or die on it. Instead of croacking IPC::Run should repeat (?) select. As a quick workaround I just commented out this line. P.S. Sorry, no test case. It is not clear for me how to trigger this in small test case. In fact I cannot even reproduce this problem with my application if I step through it in debugger.
Date: Wed, 14 Jan 2004 09:18:37 -0500
From: Barrie Slaymaker <barries [...] slaysys.com>
To: Guest via RT <bug-IPC-Run [...] rt.cpan.org>
CC: "AdminCc of cpan Ticket #4934": ;
Subject: Re: [cpan #4934] IPC::Run fails with "Interrupted system call" error
RT-Send-Cc:
On Wed, Jan 14, 2004 at 08:46:45AM -0500, Guest via RT wrote: Show quoted text
> > As I understand from select man page "Interrupted system call" (EINTR) is a normal condition and it is not correct to croak or die on it. Instead of croacking IPC::Run should repeat (?) select. As a quick workaround I just commented out this line.
You *might* want to uncomment it and add another term to the if expression that only disables it in that case. I'm in patches-only mode on most of my modules as my business is quite busy these days. There's also an open issue (see the TODO test in the test suite) dealing with moving large amounts of data. If you're just using the run() call, you might want to test drive IPC::Run3 instead. It uses temp files instead of pipes (and on Win32 instead of pipes *and* sockets combined, ugh). Show quoted text
> P.S. Sorry, no test case. It is not clear for me how to trigger this > in small test case. In fact I cannot even reproduce this problem with > my application if I step through it in debugger.
It might be that, when not in the debugger, the parent process is getting a signal (I'm assuming Unix-like or at least POSIX-like environment here) and IPC::Run needs to repeat. Perhaps that approach could be taken to make a valid test case: have a child send a signal to the parent. I'd like to at least capture this as a todo test so I never forget it's there. - Barrie
Thanks, this patch has been applied and will be part of the next CPAN release in 1-3 days. - R. [ilya@iponweb.net - Wed Jan 14 09:52:18 2004]: Show quoted text
> >>>>> "BSvR" == Barrie Slaymaker via RT <comment-IPC-Run@rt.cpan.org>
> writes: >
> BSvR> Full context and any attached attachments can be found at: > BSvR> <URL: http://rt.cpan.org/NoAuth/Bug.html?id=4934 >
>
> BSvR> On Wed, Jan 14, 2004 at 08:46:45AM -0500, Guest via RT wrote:
> >> > >> As I understand from select man page "Interrupted system call"
> (EINTR) is a normal condition and it is not correct to croak or die > on it. Instead of croacking IPC::Run should repeat (?) select. As a > quick workaround I just commented out this line. >
> BSvR> You *might* want to uncomment it and add another term to the if > BSvR> expression that only disables it in that case.
>
> BSvR> I'm in patches-only mode on most of my modules as my business is
> quite
> BSvR> busy these days. There's also an open issue (see the TODO test
> in the
> BSvR> test suite) dealing with moving large amounts of data.
> > Ok. Here a patch > > --- lib/IPC/Run.pm.bak Wed Jan 14 17:43:07 2004 > +++ lib/IPC/Run.pm Wed Jan 14 17:44:00 2004 > @@ -3118,7 +3118,7 @@ > } > last if ! $nfound && $self->{non_blocking} ; > > - croak "$! in select" if $nfound < 0 ; > + croak "$! in select" if $nfound < 0 and $! != POSIX::EINTR; > if ( _debugging_details ) { > my $map = join( > '', > > Seems to work for me. As I understand from source code select() is > already in loop so there is no need to redo it right after recieving > EINTR. select() will be repeated eventually anyway. >
> BSvR> If you're just using the run() call, you might want to test
> drive
> BSvR> IPC::Run3 instead. It uses temp files instead of pipes (and on
> Win32
> BSvR> instead of pipes *and* sockets combined, ugh).
> > Last time I checked I needed more that IPC::Run3 provides so probably > it is not an option for me. >
> >> P.S. Sorry, no test case. It is not clear for me how to trigger
> this
> >> in small test case. In fact I cannot even reproduce this problem
> with
> >> my application if I step through it in debugger.
>
> BSvR> It might be that, when not in the debugger, the parent process
> is
> BSvR> getting a signal (I'm assuming Unix-like or at least POSIX-like > BSvR> environment here) and IPC::Run needs to repeat. Perhaps that
> approach
> BSvR> could be taken to make a valid test case: have a child send a
> signal to
> BSvR> the parent. I'd like to at least capture this as a todo test so
> I never
> BSvR> forget it's there.
> > This test case seems to be a bit not trivial (compared with patch) and > I'm in "patches-only mode on most of my modules as my business is > quite busy these days" mode too ;) So sorry, no test case, at least > not now.