Skip to content
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

concurrent.futures.wait() blocks forever when given duplicate Futures #64568

Closed
glangford mannequin opened this issue Jan 23, 2014 · 8 comments
Closed

concurrent.futures.wait() blocks forever when given duplicate Futures #64568

glangford mannequin opened this issue Jan 23, 2014 · 8 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@glangford
Copy link
Mannequin

glangford mannequin commented Jan 23, 2014

BPO 20369
Nosy @tim-one, @vstinner, @pablogsal, @miss-islington, @iritkatriel, @kumaraditya303
PRs
  • bpo-20369: concurrent.futures.wait() now deduplicates futures given a… #30168
  • [3.10] bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168) #30400
  • [3.9] bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168) #30401
  • Files
  • test_dupfuture_wait.py
  • issue20369.patch
  • issue20369.patch
  • issue20369.patch
  • 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:

    assignee = None
    closed_at = <Date 2022-01-04.14:35:22.675>
    created_at = <Date 2014-01-23.15:33:51.643>
    labels = ['easy', 'type-bug', '3.9', '3.10', '3.11', 'library']
    title = 'concurrent.futures.wait() blocks forever when given duplicate Futures'
    updated_at = <Date 2022-01-04.14:35:22.675>
    user = 'https://bugs.python.org/glangford'

    bugs.python.org fields:

    activity = <Date 2022-01-04.14:35:22.675>
    actor = 'AlexWaygood'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-04.14:35:22.675>
    closer = 'AlexWaygood'
    components = ['Library (Lib)']
    creation = <Date 2014-01-23.15:33:51.643>
    creator = 'glangford'
    dependencies = []
    files = ['33660', '33665', '33708', '33751']
    hgrepos = []
    issue_num = 20369
    keywords = ['patch', 'easy']
    message_count = 7.0
    messages = ['208960', '208979', '209241', '209454', '408390', '409676', '409681', '409682']
    nosy_count = 6.0
    nosy_names = ['tim.peters', 'vstinner', 'pablogsal', 'miss-islington', 'iritkatriel', 'kumaraditya']
    pr_nums = ['30168', '30400', '30401']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20369'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @glangford
    Copy link
    Mannequin Author

    glangford mannequin commented Jan 23, 2014

    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 bpo-20367.

    @glangford
    Copy link
    Mannequin Author

    glangford mannequin commented Jan 23, 2014

    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 bpo-20367. Suggestions welcome.

    @glangford
    Copy link
    Mannequin Author

    glangford mannequin commented Jan 25, 2014

    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.

    @glangford
    Copy link
    Mannequin Author

    glangford mannequin commented Jan 27, 2014

    Updated patch with change to Doc/library/concurrent.futures.rst.

    @iritkatriel
    Copy link
    Member

    Reproduced on 3.11.

    @iritkatriel iritkatriel added stdlib Python modules in the Lib dir 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes type-bug An unexpected behavior, bug, or error easy labels Dec 12, 2021
    @pablogsal
    Copy link
    Member

    New changeset 7d7817c by Kumar Aditya in branch 'main':
    bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
    7d7817c

    @miss-islington
    Copy link
    Contributor

    New changeset 9a9061d by Miss Islington (bot) in branch '3.9':
    bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
    9a9061d

    @miss-islington
    Copy link
    Contributor

    New changeset ba12467 by Miss Islington (bot) in branch '3.10':
    bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
    ba12467

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants