[ python-Bugs-1068268 ] subprocess is not EINTR-safe

SourceForge.net noreply at sourceforge.net
Wed Dec 22 08:07:59 CET 2004


Bugs item #1068268, was opened at 2004-11-18 05:07
Message generated for change (Comment added) made by mattjohnston
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1068268&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 3
Submitted By: Peter Åstrand (astrand)
Assigned to: Peter Åstrand (astrand)
Summary: subprocess is not EINTR-safe

Initial Comment:
The subprocess module is not safe for use with signals,
because it doesn't retry the system calls upon EINTR.
However, as far as I understand it, this is true for
most other Python modules as well, so it isn't obvious
that the subprocess needs to be fixed. 

The problem was first noticed by John P Speno. 

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

Comment By: Matt Johnston (mattjohnston)
Date: 2004-12-22 15:07

Message:
Logged In: YES 
user_id=785805

I've hit this on a Solaris 9 box without explicitly using
signals. Using the DCOracle module, a seperate Oracle
process is executed. When this terminates, a SIGCHLD is sent
to the calling python process, which may be in the middle of
a select() in the communicate() call, causing EINTR. From
the output of truss (like strace), a sigchld handler doesn't
appear to be getting explicitly installed by the Oracle module.

SunOS 5.9 Generic_112233-01 sun4u sparc SUNW,Sun-Fire-280R

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

Comment By: Peter Åstrand (astrand)
Date: 2004-11-18 05:15

Message:
Logged In: YES 
user_id=344921

One way of testing subprocess for signal-safeness is to
insert these lines just after _cleanup():

import signal
signal.signal(signal.SIGALRM, lambda x,y: 1)
signal.alarm(1)
import time
time.sleep(0.99)

Then run test_subprocess.py. 

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

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


More information about the Python-bugs-list mailing list