Bug 2350287
Summary: | cockpit fails to build from source with Python 3.14: AttributeError: module 'asyncio' has no attribute 'SafeChildWatcher' | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Karolina Surma <ksurma> |
Component: | cockpit | Assignee: | Martin Pitt <mpitt> |
Status: | POST --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | allison.karlitskaya, jvanderwaa, kkoukiou, mmarusak, mpitt, patrick, stefw, vstinner |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | --- | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | Type: | --- | |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 2322407 |
Description
Karolina Surma
2025-03-06 09:52:32 UTC
The root cause of this issue is the removal of PidfdChildWatcher in https://github.com/python/cpython/pull/120893 The code in question only falls back to trying to use SafeChildWatcher if PidfdChildWatcher is not present: @staticmethod def _create_watcher() -> asyncio.AbstractChildWatcher: try: os.close(os.pidfd_open(os.getpid(), 0)) # check for kernel support return asyncio.PidfdChildWatcher() except (AttributeError, OSError): pass return asyncio.SafeChildWatcher() This was a public API, documented in the official documentation, and not deprecated nor officially slated for removal. https://docs.python.org/3/library/asyncio-policy.html#asyncio.PidfdChildWatcher I just filed https://github.com/python/cpython/issues/130915 Hopefully they can change this before the release. The Python asyncio maintainer has just indicated (in the linked bug report) that dropping a public documented symbol from one release to the next without deprecation or any other warning is "intended behavior". I think we're going to have to deal with this :( I am currently looking into this, and I'm stumped how the API is actually supposed to work in current Python (i.e. >= 3.12): - https://docs.python.org/3/whatsnew/3.12.html#asyncio and https://github.com/python/cpython/issues/130915#issuecomment-2704219327 mention that the entire child watcher API is deprecated. - https://docs.python.org/3.13/library/asyncio-policy.html#process-watchers also has everything deprecated, i.e. it doesn't mention any current API - So maybe this cannot be used with arbitrary processes any more, but just with the "Process" class that asyncio.create_subprocess_exec() returns? But https://docs.python.org/3.13/library/asyncio-subprocess.html#asyncio.subprocess.Process *also* doesn't have anything like "invoke this callback then the process exits". The only thing it has is `async wait`, which could possibly be run in a task? I proposed a fix upstream, can someone please have a look and/or test it? https://github.com/cockpit-project/cockpit/pull/21787 We now have a fix in https://github.com/cockpit-project/cockpit/pull/21775 which will land soon. Thanks Victor! Looking forward to the upstream discussion, maybe they can expose the watcher property as API. |