Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938761 - CI job for pypy3.10 fails intermittently with RuntimeError: Event loop is closed
Summary: CI job for pypy3.10 fails intermittently with RuntimeError: Event loop is closed
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: PullRequest, REGRESSION
Depends on:
Blocks: 933499
  Show dependency tree
 
Reported: 2024-08-30 22:49 UTC by Sam James
Modified: 2024-08-31 19:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Zac Medico gentoo-dev 2024-08-31 18:10:24 UTC
Retry often succeeds:

https://github.com/gentoo/portage/actions/runs/10647089451/job/29514865939

The symptom is kind of similar to bug 916142 but that was not an intermittent issue.
Comment 2 Zac Medico gentoo-dev 2024-08-31 18:31:52 UTC
It's possible that a loop from asyncio.run, wrapped by _get_running_loop from this bug 937740 commit, is later closed unexpectedly:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=cb0c09d8cecbcc086786e3e2c7cdd8ffc023a48a

We could detect closed loops in _safe_loop and then replace them if needed.
Comment 3 Larry the Git Cow gentoo-dev 2024-08-31 19:20:58 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=ee17cbd807ba976491e4c657be8aa9b9a29fe059

commit ee17cbd807ba976491e4c657be8aa9b9a29fe059
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2024-08-31 19:06:25 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2024-08-31 19:06:25 +0000

    _safe_loop: Discard wrapped asyncio.run loop that was closed
    
    Since commit cb0c09d8cecb, _get_running_loop can wrap loops from
    asyncio.run, so these loops need to be discarded if they've been
    closed.
    
    Fixes: cb0c09d8cecb ("Support coroutine exitfuncs for non-main loops")
    Bug: https://bugs.gentoo.org/938761
    Bug: https://bugs.gentoo.org/761538
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/util/futures/_asyncio/__init__.py | 7 +++++++
 1 file changed, 7 insertions(+)