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

asyncio.wait_for does not wait for task/future to be completed in all cases #86057

Closed
rkojedzinszky mannequin opened this issue Sep 30, 2020 · 6 comments
Closed

asyncio.wait_for does not wait for task/future to be completed in all cases #86057

rkojedzinszky mannequin opened this issue Sep 30, 2020 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@rkojedzinszky
Copy link
Mannequin

rkojedzinszky mannequin commented Sep 30, 2020

BPO 41891
Nosy @asvetlov, @1st1, @miss-islington, @uriyyo, @rkojedzinszky
PRs
  • bpo-41891: ensure asyncio.wait_for waits for task completion #22461
  • [3.9] bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) #23840
  • [3.8] bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) #23841
  • 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 2020-12-18.17:26:50.907>
    created_at = <Date 2020-09-30.11:01:52.083>
    labels = ['3.8', 'type-bug', '3.7', 'expert-asyncio']
    title = 'asyncio.wait_for does not wait for task/future to be completed in all cases'
    updated_at = <Date 2020-12-18.20:13:02.703>
    user = 'https://github.com/rkojedzinszky'

    bugs.python.org fields:

    activity = <Date 2020-12-18.20:13:02.703>
    actor = 'uriyyo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-12-18.17:26:50.907>
    closer = 'yselivanov'
    components = ['asyncio']
    creation = <Date 2020-09-30.11:01:52.083>
    creator = 'rkojedzinszky'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41891
    keywords = ['patch']
    message_count = 6.0
    messages = ['377695', '383307', '383308', '383311', '383322', '383324']
    nosy_count = 5.0
    nosy_names = ['asvetlov', 'yselivanov', 'miss-islington', 'uriyyo', 'rkojedzinszky']
    pr_nums = ['22461', '23840', '23841']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41891'
    versions = ['Python 3.7', 'Python 3.8']

    @rkojedzinszky
    Copy link
    Mannequin Author

    rkojedzinszky mannequin commented Sep 30, 2020

    This code should run without errors:

    #!/usr/bin/env python
    
    import asyncio
    
    async def task1():
        cv = asyncio.Condition()
    
        async with cv:
            await asyncio.wait_for(cv.wait(), 10)
    
    async def main(loop):
        task = loop.create_task(task1())
    
        await asyncio.sleep(0)
    
        task.cancel()
    
        res = await asyncio.wait({task})
    
    if __name__ == '__main__':
        loop = asyncio.get_event_loop()
    
        loop.run_until_complete(main(loop))
    

    @rkojedzinszky rkojedzinszky mannequin added 3.7 (EOL) end of life 3.8 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error labels Sep 30, 2020
    @1st1
    Copy link
    Member

    1st1 commented Dec 18, 2020

    New changeset 17ef431 by Richard Kojedzinszky in branch 'master':
    bpo-41891: ensure asyncio.wait_for waits for task completion (bpo-22461)
    17ef431

    @1st1
    Copy link
    Member

    1st1 commented Dec 18, 2020

    Thanks for the PR, Richard!

    @1st1 1st1 closed this as completed Dec 18, 2020
    @1st1 1st1 closed this as completed Dec 18, 2020
    @miss-islington
    Copy link
    Contributor

    New changeset a3dec9d by Miss Islington (bot) in branch '3.8':
    bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461)
    a3dec9d

    @1st1
    Copy link
    Member

    1st1 commented Dec 18, 2020

    New changeset 82dbfd5 by Miss Islington (bot) in branch '3.9':
    bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) (bpo-23840)
    82dbfd5

    @uriyyo
    Copy link
    Member

    uriyyo commented Dec 18, 2020

    Yurii no worries, I am happy that this issue is resolved)

    @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.7 (EOL) end of life 3.8 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants