New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make test_mailbox deterministic #56076
Comments
Attached is a patch to remove the last sleeps from test_mailbox. I believe this makes the test suite deterministic. It also shaves 4 seconds of fixed overhead off the test run time. |
Nice ping pong you play.. Using random seed 2215045
[1/1] test_mailbox
test test_mailbox failed -- multiple errors occurred; run in verbose mode for details
test test_mailbox failed -- Traceback (most recent call last):
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1033, in test_lock_conflict
ipc.signal('done')
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1007, in __exit__
self.c_sock.shutdown(socket.SHUT_RDWR)
socket.error: [Errno 57] Socket is not connected
test test_mailbox failed -- Traceback (most recent call last):
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1033, in test_lock_conflict
ipc.signal('done')
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1007, in __exit__
self.c_sock.shutdown(socket.SHUT_RDWR)
socket.error: [Errno 57] Socket is not connected /Users/steffen/usr/opt/py3k/lib/python3.3/test/regrtest.py:1082: ResourceWarning: unclosed <socket.socket object, fd=5, family=2, type=1, proto=0> ... ====================================================================== Traceback (most recent call last):
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1033, in test_lock_conflict
ipc.signal('done')
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1007, in __exit__
self.c_sock.shutdown(socket.SHUT_RDWR)
socket.error: [Errno 57] Socket is not connected ====================================================================== Traceback (most recent call last):
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1033, in test_lock_conflict
ipc.signal('done')
File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_mailbox.py", line 1007, in __exit__
self.c_sock.shutdown(socket.SHUT_RDWR)
socket.error: [Errno 57] Socket is not connected Ran 332 tests in 55.487s FAILED (errors=2) ... repeats yet another two times (very long output though) ---------------------------------------------------------------------- OK |
Thanks for testing this. I was afraid something like that would happen, since socket implementations are different on different platforms. I presume you ran it on OSX. Now I have to decide if I want to fix it, or if I should just switch to using threads. |
Short glance into it, and after 15:36 ~/tmp $ python3 -E -Wd -m test -r -w -uall test_mailbox |
I think the fix is to either put a try/except around the socket shutdown call, or to remove it entirely (I think things will still work right on linux without it). If you leave the self.c_sock_close = True in, it should take care of the resource warning. |
'Was not allowed to look yesterday. 12:59 ~/tmp $ python3 -E -Wd -m test -r -w test_mailbox |
There was a recent buildbot failure on test_lock_conflict() because of a race. |
Probably because I'm a threading/multiprocessing neophyte :) (Though I just learned a bunch about programming with threads recently...) |
That's a very good reason :-) Here's a version using two multiprocessing events. Note that I use By the way, next time you need a duplex communication between two |
Charles-François's patch looks good to me. |
New changeset c6d41dd60d2d by Charles-François Natali in branch '2.7': New changeset 0053b7c68a02 by Charles-François Natali in branch '3.2': New changeset 020260ec44f2 by Charles-François Natali in branch 'default': |
Should be fixed now, thanks! |
New changeset c9facd251725 by Charles-François Natali in branch '2.7': New changeset 9dee8a095faf by Charles-François Natali in branch '3.2': New changeset 9014e0cc5589 by Charles-François Natali in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: