You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/san_cis/home/cis/.buildbot/python-aix6/3.x.phenix.xlc/build/Lib/test/fork_wait.py", line 72, in test_waitself.wait_impl(cpid)
File "./Lib/test/test_wait4.py", line 23, in wait_implself.assertEqual(spid, cpid)
AssertionError: 0 != 1486954
Ran 1 test in 12.030s
FAILED (failures=1)
Traceback (most recent call last):
File "./Lib/test/test_wait4.py", line 32, in <module>
test_main()
File "./Lib/test/test_wait4.py", line 28, in test_main
run_unittest(Wait4Test)
File "/san_cis/home/cis/.buildbot/python-aix6/3.x.phenix.xlc/build/Lib/test/support.py", line 1145, in run_unittest
_run_suite(suite)
File "/san_cis/home/cis/.buildbot/python-aix6/3.x.phenix.xlc/build/Lib/test/support.py", line 1128, in _run_suiteraise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
File "/san_cis/home/cis/.buildbot/python-aix6/3.x.phenix.xlc/build/Lib/test/fork_wait.py", line 72, in test_waitself.wait_impl(cpid)
File "./Lib/test/test_wait4.py", line 23, in wait_implself.assertEqual(spid, cpid)
AssertionError: 0 != 1486954
Thanks in advance
sable commented on Feb 17, 2011
sablemannequin
MannequinAuthor
More actions
This issue already existed on Python 2.5.2 with AIX 5.2:
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...
--- 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)
"""
Replace the wait4() call with a waitpid() call...
....like this:
for(n=0;waitpid(-1, &status, WNOHANG) > 0; n++) ;
Or, compile the existing code with the BSD library:
cc -o demo demo.c -D_BSD -lbsd
Both will work...
The current problem is that child process is not "seen" by the wait4()
call,
so that when "signal" is rearmed, it immediately goes (recursively)
into the
child_handler() function.
"""
So it seems that under AIX, posix_wait4 should be compiled with -D_BSD -lbsd.
Could you try this ?
If this doesn't do the trick, then avoiding passing WNOHANG could be the second option.
sable commented on Mar 7, 2011
sablemannequin
MannequinAuthor
More actions
I had seen that post you mentioned and already tested the -lbsd without success.
Maybe it was present on older versions of the system. But I couldn't find any documentation mentioning wait4 and -lbsd anywhere.
Actually wait4 is never mentioned in the IBM documentation concerning AIX.
wait4 without WNOHANG works fine. waitpid works fine even with WNOHANG.
I don't know which workaround is the better.
I will also try to report this bug to IBM so that a future version of AIX could work correctly.
neologix commented on Mar 7, 2011
neologixmannequin
Mannequin
More actions
wait4 without WNOHANG works fine. waitpid works fine even with WNOHANG.
I don't know which workaround is the better.
As far as the test is concerned, it's of course better to use wait4
without WNOHANG in a test names test_wait4 (especially since waitpid
is tested elsewhere)...
sable commented on Mar 8, 2011
sablemannequin
MannequinAuthor
More actions
Yes, for the test, as I put in msg128727, it works fine by removing WNOHANG.
However I should put a note in the AIX-NOTES file to explain that wait4 is broken with WNOHANG on AIX and suggest the 2 workarounds.
Activity
sable commentedon Feb 11, 2011
I get an error when running test_wait4 with trunk on AIX:
test_wait (main.Wait4Test) ... FAIL
======================================================================
FAIL: test_wait (main.Wait4Test)
----------------------------------------------------------------------
Ran 1 test in 12.030s
Thanks in advance
sable commentedon Feb 17, 2011
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
===================================================================
neologix commentedon Mar 6, 2011
If test_wait3 and test_fork1 pass, then yes, it's probably an issue with AIX's wait4.
See http://fixunix.com/aix/84872-sigchld-recursion.html:
"""
Replace the wait4() call with a waitpid() call...
....like this:
for(n=0;waitpid(-1, &status, WNOHANG) > 0; n++) ;
Or, compile the existing code with the BSD library:
cc -o demo demo.c -D_BSD -lbsd
Both will work...
The current problem is that child process is not "seen" by the wait4()
call,
so that when "signal" is rearmed, it immediately goes (recursively)
into the
child_handler() function.
"""
So it seems that under AIX, posix_wait4 should be compiled with -D_BSD -lbsd.
Could you try this ?
If this doesn't do the trick, then avoiding passing WNOHANG could be the second option.
sable commentedon Mar 7, 2011
I had seen that post you mentioned and already tested the -lbsd without success.
wait4 is not even present in libbsd.
phenix:
$ nm /usr/lib/libbsd.a | grep wait$phenix:
Maybe it was present on older versions of the system. But I couldn't find any documentation mentioning wait4 and -lbsd anywhere.
Actually wait4 is never mentioned in the IBM documentation concerning AIX.
wait4 without WNOHANG works fine. waitpid works fine even with WNOHANG.
I don't know which workaround is the better.
I will also try to report this bug to IBM so that a future version of AIX could work correctly.
neologix commentedon Mar 7, 2011
As far as the test is concerned, it's of course better to use wait4
without WNOHANG in a test names test_wait4 (especially since waitpid
is tested elsewhere)...
sable commentedon Mar 8, 2011
Yes, for the test, as I put in msg128727, it works fine by removing WNOHANG.
However I should put a note in the AIX-NOTES file to explain that wait4 is broken with WNOHANG on AIX and suggest the 2 workarounds.
DavidEdelsohn commentedon Jul 3, 2013
The patch in msg128727 is correct for AIX and should be applied.
python-dev commentedon Jul 4, 2013
New changeset b3ea1b5a1617 by Antoine Pitrou in branch '3.3':
Issue bpo-11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé.
http://hg.python.org/cpython/rev/b3ea1b5a1617
New changeset 8055521e372f by Antoine Pitrou in branch 'default':
Issue bpo-11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé.
http://hg.python.org/cpython/rev/8055521e372f
python-dev commentedon Jul 4, 2013
New changeset e3fd5fc5dc47 by Antoine Pitrou in branch '2.7':
Issue bpo-11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé.
http://hg.python.org/cpython/rev/e3fd5fc5dc47
pitrou commentedon Jul 4, 2013
Thank you. This should be fixed now. Please reopen if not.