Issue 10432: concurrent.futures.as_completed() spins waiting for futures to complete (original) (raw)

Created on 2010-11-16 10:59 by scott.dial, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
futures-r86476.patch scott.dial,2010-11-16 10:59 proposed patch against r86476
Messages (4)
msg121280 - (view) Author: Scott Dial (scott.dial) Date: 2010-11-16 10:59
The code in as_completed() waits on a FIRST_COMPLETED event, which means that after the first future completes, it will no longer wait at all. The proposed patch adds a _AsCompletedWaiter and uses a lock to swap out the finished list and reset the event. This is a difficult problem to create a test case for without adding intrusive code to as_completed() to count how many times it loops or create a mock Event object that counts it, so I have not proposed a test.
msg121344 - (view) Author: Brian Quinlan (bquinlan) * (Python committer) Date: 2010-11-17 11:08
Looks good but you forgot to actually use your new Waiter ;-) Committed as r86491.
msg121345 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-11-17 11:09
Please mention the issue number in the commit message when applying patches or bugfixes.
msg121347 - (view) Author: Scott Dial (scott.dial) Date: 2010-11-17 11:29
Good catch. I suppose it was inevitable when I transferred my changes into a SVN checkout that I missed something. Nevertheless, your changeset in r86491 matches my own. Thanks!
History
Date User Action Args
2022-04-11 14:57:08 admin set github: 54641
2010-11-17 11:29:53 scott.dial set messages: +
2010-11-17 11:09:36 georg.brandl set nosy: + georg.brandlmessages: +
2010-11-17 11:08:12 bquinlan set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2010-11-16 11:52:44 orsenthil set assignee: bquinlanstage: patch reviewnosy: + bquinlanversions: - Python 3.3
2010-11-16 10:59:34 scott.dial create