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.

Author sable
Recipients sable
Date 2011-02-17.15:19:37
SpamBayes Score 4.777234e-12
Marked as misclassified No
Message-id <1297955977.94.0.123892289065.issue11185@psf.upfronthosting.co.za>
In-reply-to
Content
This issue already existed on Python 2.5.2 with AIX 5.2:

http://www.mail-archive.com/python-list@python.org/msg192219.html

The documentation for WNOHANG says:
http://docs.python.org/library/os.html#os.WNOHANG
"""
The option for waitpid() to return immediately if no child process status is available immediately. The function returns (0, 0) in this case.
"""

It seems wait4 always returns 0 on AIX when WNOHANG is specified.

Removing WNOHANG will make the test succeed.

waitpid does not have the same limitation.

I suppose this is a bug of AIX, though there is not even a man page to describe wait4 on this platform.

Here is a proposition for a patch that will workaround this bug...

Index: Lib/test/test_wait4.py
===================================================================
--- Lib/test/test_wait4.py      (revision 88430)
+++ Lib/test/test_wait4.py      (working copy)
@@ -3,6 +3,7 @@
 
 import os
 import time
+import sys
 from test.fork_wait import ForkWait
 from test.support import run_unittest, reap_children, get_attribute
 
@@ -13,10 +14,14 @@
 
 class Wait4Test(ForkWait):
     def wait_impl(self, cpid):
+        option = os.WNOHANG
+        if sys.platform.startswith('aix'):
+            # wait4 is broken on AIX and will always return 0 with WNOHANG
+            option = 0
         for i in range(10):
             # wait4() shouldn't hang, but some of the buildbots seem to hang
             # in the forking tests.  This is an attempt to fix the problem.
-            spid, status, rusage = os.wait4(cpid, os.WNOHANG)
+            spid, status, rusage = os.wait4(cpid, option)
             if spid == cpid:
                 break
             time.sleep(1.0)
History
Date User Action Args
2011-02-17 15:19:38sablesetrecipients: + sable
2011-02-17 15:19:37sablesetmessageid: <1297955977.94.0.123892289065.issue11185@psf.upfronthosting.co.za>
2011-02-17 15:19:37sablelinkissue11185 messages
2011-02-17 15:19:37sablecreate