ports/132093: python's subprocess.py fails with 'Interrupted system call'
Lapo Luchini
lapo at lapo.it
Wed Feb 25 10:10:04 UTC 2009
>Number: 132093
>Category: ports
>Synopsis: python's subprocess.py fails with 'Interrupted system call'
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Feb 25 10:10:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Lapo Luchini
>Release: FreeBSD 6.4-STABLE amd64
>Organization:
>Environment:
System: FreeBSD motoko.lapo.it 6.4-STABLE FreeBSD 6.4-STABLE #9: Thu Jan 29 15:50:58 CET 2009 root at motoko.lapo.it:/usr/obj/usr/src/sys/MOTOKO amd64
>Description:
Python's subprocess.py doesn't expect 'waitpid' to return 'Interrupted system call' and often fails with it.
I experienced this problem both with lang/python25 and lang/python26, but didn't check others.
>How-To-Repeat:
For example this was using devel/qct (happens very very often, making it almost unusable):
Traceback (most recent call last):
File "/usr/local/bin/qct", line 123, in <module>
dialog = CommitTool(vcs)
File "/usr/local/lib/python2.6/site-packages/qctlib/gui_logic.py", line 154, in __init__
self.__rescanFiles()
File "/usr/local/lib/python2.6/site-packages/qctlib/gui_logic.py", line 223, in __rescanFiles
self.itemList = self.vcs.scanFiles(self.showIgnored, pb)
File "/usr/local/lib/python2.6/site-packages/qctlib/vcs/svn.py", line 87, in scanFiles
statusOutput = runProgram([self.svn_exe] + extra + ['status'])
File "/usr/local/lib/python2.6/site-packages/qctlib/utils.py", line 126, in runProgram
code = pop.wait()
File "/usr/local/lib/python2.6/subprocess.py", line 1137, in wait
pid, sts = os.waitpid(self.pid, 0)
OSError: [Errno 4] Interrupted system call
>Fix:
Personally I solved my immediate problem with the following patch (retries waitpid if it was interrupted), but a more torough one can be found at this address:
http://mail.python.org/pipermail/python-dev/2004-November/049983.html
--- /usr/local/lib/python2.6/subprocess.py.orig 2009-02-17 11:34:13.000000000 +0100
+++ /usr/local/lib/python2.6/subprocess.py 2009-02-17 11:34:43.000000000 +0100
@@ -1130,11 +1130,23 @@
return self.returncode
+ def _waitpid_no_intr(self, pid, options):
+ """Like os.waitpid, but retries on EINTR"""
+ while True:
+ try:
+ return os.waitpid(pid, options)
+ except OSError, e:
+ if e.errno == errno.EINTR:
+ continue
+ else:
+ raise
+
+
def wait(self):
"""Wait for child process to terminate. Returns returncode
attribute."""
if self.returncode is None:
- pid, sts = os.waitpid(self.pid, 0)
+ pid, sts = self._waitpid_no_intr(self.pid, 0)
self._handle_exitstatus(sts)
return self.returncode
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list