Matt Joiner <anacro...@gmail.com> added the comment: Patch with a test included. Being a nondeterministic bug, please adjust the thread count, or timing as necessary, the parameters in the patch are as low as I can get them and still reasonably reproduce the bug (linux 3.2, i386).
There's a few complications in testing this. Firstly timeouts cannot be used, because at the end of the timeout, all the futures are checked to categorize them into done and not done. Except for taking the entire duration of the timeout given to return, the bug is masked in this case. Secondly, it can't be known how long a wait *should* take, so failing after some duration and assuming a stall due to the race decrementing num_pending_calls would be a guess dependent on the capabilities of the system. If a timeout needs to be added (and fired from an outside thread for reasons given above), please let me know, and direct me to an example of this kind of testing elsewhere in the stdlib, so I can do this idiomatically. Without applying the patch, the test case provided will (usually) hang indefinitely. ---------- Added file: http://bugs.python.org/file25078/concurrent.futures._AllCompletedWaiter.num_pending_calls-race-test.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14406> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com