This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Popen3.poll race condition
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: nnorwitz, sf-robot, tseaver
Priority: normal Keywords:

Created on 2004-07-26 19:14 by tseaver, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg21820 - (view) Author: Tres Seaver (tseaver) * Date: 2004-07-26 19:14
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.
msg21821 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-03-23 08:45
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?
msg21822 - (view) Author: Tres Seaver (tseaver) * Date: 2006-03-23 12:21
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.
msg21823 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-03-25 04:59
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.
msg21824 - (view) Author: SourceForge Robot (sf-robot) Date: 2006-04-09 02:20
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).
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40649
2004-07-26 19:14:58tseavercreate