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] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed." #74608

Closed
jimmylai mannequin opened this issue May 21, 2017 · 2 comments
Labels

Comments

@jimmylai
Copy link
Mannequin

jimmylai mannequin commented May 21, 2017

BPO 30423
Nosy @asvetlov, @ambv, @1st1, @jimmylai
PRs
  • [asyncio] bpo-30423 bug: orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed." #1688
  • [3.6] bpo-30423: call remove_done_callback in finally section (GH-1688) #1755
  • [3.5] bpo-30423: call remove_done_callback in finally section (GH-1688) #1758
  • [asyncio] bpo-30423: add regression test for orphan future causes "RuntimeError: Event loop stopped before Future completed." #3295
  • 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 2017-05-23.07:37:31.504>
    created_at = <Date 2017-05-21.13:44:28.150>
    labels = ['3.7', 'expert-asyncio']
    title = '[asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed."'
    updated_at = <Date 2017-11-01.13:54:48.076>
    user = 'https://github.com/jimmylai'

    bugs.python.org fields:

    activity = <Date 2017-11-01.13:54:48.076>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-05-23.07:37:31.504>
    closer = 'lukasz.langa'
    components = ['asyncio']
    creation = <Date 2017-05-21.13:44:28.150>
    creator = 'jimmylai'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30423
    keywords = []
    message_count = 2.0
    messages = ['294102', '305382']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'lukasz.langa', 'yselivanov', 'jimmylai']
    pr_nums = ['1688', '1755', '1758', '3295']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30423'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @jimmylai
    Copy link
    Mannequin Author

    jimmylai mannequin commented May 21, 2017

    Problem:
    "RuntimeError: Event loop stopped before Future completed." throws when calling run_until_complete().

    We investigate and find out some orphan futures stay in the event loop before we run another run_until_complete(another_async_func()).
    The orphan future has pending state and is attached with _run_until_complete_cb from previous run_until_complete.
    It happens because the orphan future thrown Exception and then raise, thus remove_done_callback(_run_until_complete_cb) didn't called.
    Move it to finally section can fix it.
    With this patch, we stop seeing the Runtime Error.

    @jimmylai jimmylai mannequin added the topic-asyncio label May 21, 2017
    @ambv ambv added the 3.7 (EOL) end of life label May 23, 2017
    @ambv ambv closed this as completed May 23, 2017
    @asvetlov
    Copy link
    Contributor

    asvetlov commented Nov 1, 2017

    New changeset d1e3403 by Andrew Svetlov (jimmylai) in branch 'master':
    [asyncio] bpo-30423: add regression test for orphan future causes "RuntimeError: Event loop stopped before Future completed." (bpo-3295)
    d1e3403

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants