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.

classification
Title: concurrent.futures.wait() blocks forever when given duplicate Futures
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, kumaraditya, miss-islington, pablogsal, tim.peters, vstinner
Priority: normal Keywords: easy, patch

Created on 2014-01-23 15:33 by glangford, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_dupfuture_wait.py glangford, 2014-01-23 15:33
issue20369.patch glangford, 2014-01-23 19:20 review
issue20369.patch glangford, 2014-01-25 21:46 review
issue20369.patch glangford, 2014-01-27 17:49 review
Pull Requests
URL Status Linked Edit
PR 30168 merged kumaraditya, 2021-12-17 12:02
PR 30400 merged miss-islington, 2022-01-04 13:36
PR 30401 merged miss-islington, 2022-01-04 13:36
Messages (7)
msg208960 - (view) Author: Glenn Langford (glangford) * Date: 2014-01-23 15:33
For a Future f which has already completed, 
  wait( [f,f], return_when=ALL_COMPLETED ) 
blocks forever.

This is because the test in wait():

  if len(done) == len(fs)

is comparing the length of a set to the length of a list. 

If f has not completed, wait( [f,f] ) will yield f once. The behaviour should be consistent with as_completed() - see issue #20367.
msg208979 - (view) Author: Glenn Langford (glangford) * Date: 2014-01-23 19:20
Proposed patch...please treat with an appropriate level of suspicion since this is my first patch submission. :-)  

A corresponding change will be made to as_completed() for #20367. Suggestions welcome.
msg209241 - (view) Author: Glenn Langford (glangford) * Date: 2014-01-25 21:46
Updated patch with a test case, and added a minor note to the docstring to clarify behaviour.

The use of sleep() in the test is not great, but it is the most obvious way to test and it is consistent with the approach used in other concurrent test cases.
msg209454 - (view) Author: Glenn Langford (glangford) * Date: 2014-01-27 17:49
Updated patch with change to Doc/library/concurrent.futures.rst.
msg408390 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-12-12 15:21
Reproduced on 3.11.
msg409676 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2022-01-04 13:36
New changeset 7d7817cf0f826e566d8370a0e974bbfed6611d91 by Kumar Aditya in branch 'main':
bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
https://github.com/python/cpython/commit/7d7817cf0f826e566d8370a0e974bbfed6611d91
msg409681 - (view) Author: miss-islington (miss-islington) Date: 2022-01-04 14:27
New changeset 9a9061d1ca7e28dc2b7e326153e933872c7cd452 by Miss Islington (bot) in branch '3.9':
bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
https://github.com/python/cpython/commit/9a9061d1ca7e28dc2b7e326153e933872c7cd452
msg409682 - (view) Author: miss-islington (miss-islington) Date: 2022-01-04 14:27
New changeset ba124672d7bf490bea2930a3e8371823db5d4cae by Miss Islington (bot) in branch '3.10':
bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
https://github.com/python/cpython/commit/ba124672d7bf490bea2930a3e8371823db5d4cae
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64568
2022-01-04 14:35:22AlexWaygoodsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-04 14:27:41miss-islingtonsetmessages: + msg409682
2022-01-04 14:27:40miss-islingtonsetmessages: + msg409681
2022-01-04 13:36:45pablogsalsetnosy: + pablogsal
messages: + msg409676
2022-01-04 13:36:33miss-islingtonsetpull_requests: + pull_request28609
2022-01-04 13:36:28miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28608
2021-12-22 13:19:04mark.dickinsonsetnosy: - mark.dickinson
2021-12-17 12:02:48kumaradityasetkeywords: + patch
nosy: + kumaraditya

pull_requests: + pull_request28385
stage: patch review
2021-12-12 15:24:35iritkatrielsetkeywords: + easy, - patch
2021-12-12 15:21:38iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.3, Python 3.4
nosy: + iritkatriel

messages: + msg408390

components: + Library (Lib)
type: behavior
2014-07-18 16:45:55glangfordsetnosy: - glangford
2014-01-27 17:49:41glangfordsetfiles: + issue20369.patch

messages: + msg209454
2014-01-25 21:46:30glangfordsetfiles: + issue20369.patch

messages: + msg209241
2014-01-23 19:20:56glangfordsetfiles: + issue20369.patch
keywords: + patch
messages: + msg208979
2014-01-23 15:33:51glangfordcreate