[ python-Bugs-998246 ] Popen3.poll race condition

SourceForge.net noreply at sourceforge.net
Sun Apr 9 04:20:26 CEST 2006


Bugs item #998246, was opened at 07/26/04 12:14
Message generated for change (Comment added) made by sf-robot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=998246&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Tres Seaver (tseaver)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Popen3.poll race condition

Initial Comment:
poll() swallows all IOErrors, including ENOCHILD;  if
the child process exits before poll is called, then an
applications which loops on
poll() will never exit.

I am working around this (against Python 2.3.3) via the
following:


                try:
                    pid, status = os.waitpid(proc.pid,
os.WNOHANG)
                except os.error, e:
                    if e.errno == 10:  # ENOCHILD
                        result = 0
                    else:
                        raise
                else:
                    if pid == proc.pid:
                        result = status


where 'proc' is an instance of Popen3.

----------------------------------------------------------------------

>Comment By: SourceForge Robot (sf-robot)
Date: 04/08/06 19:20

Message:
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 03/24/06 20:59

Message:
Logged In: YES 
user_id=33168

Tres, Martin and I worked out a patch that we thinks solves
the problem.  It's checked in.  See the other bug report for
more info.  If you don't believe the patch will fix your
problem, change the status from pending to open.  Otherwise,
this bug should automatically close in a couple of weeks.

----------------------------------------------------------------------

Comment By: Tres Seaver (tseaver)
Date: 03/23/06 04:21

Message:
Logged In: YES 
user_id=127625

1183780 is indeed a similar bug, although he reports it
against Popen4 rather than Popen3.  His patch needs to be
modified to re-raise errors which are not ENOCHILD, however.

I no longer have accees to either the application or the
machine where I found this issue, and hence can't verify that
the patch fixes the code which triggered the problem.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 03/23/06 00:45

Message:
Logged In: YES 
user_id=33168

I believe this is basically a duplicate of 1183780.  There
is a patch attached there.  Can you verify if it fixes your
problem?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=998246&group_id=5470


More information about the Python-bugs-list mailing list