Skip to content

PidfdChildWatcher runs callbacks on the main thread eventloop and not the currently running loop #94182

Description

@graingert

as of #93896 and #94593 asyncio.Runner(loop_factory=asyncio.new_event_loop) no longer calls asyncio.set_event_loop() and so the PidfdChildWatcher is never activated

this is unfortunate because it could run asyncio.get_running_loop().add_reader instead

Activity

  1. kumaraditya303 commented on Jul 9, 2022

    @kumaraditya303
    Contributor

    Wasn't this fixed by #94593?

  2. graingert commented on Jul 9, 2022

    @graingert
    ContributorAuthor

    Wasn't this fixed by #94593?

    No

  3. graingert commented on Jul 9, 2022

    @graingert
    ContributorAuthor

    The purpose of os.open_pidfd is to allow a single event loop running in any thread to monitor processes without needing to interact with another event loop or thread. The pidfdchildwatcher is currently unnecessarily using another loop in another thread

  4. graingert commented on Jul 19, 2022

    @graingert
    ContributorAuthor

    @kumaraditya303 I can demonstrate that the issue is still not resolved by using 5647edb (#94184) - I updated the description to clarify this

  5. added a commit that references this issue on Oct 8, 2022
  6. gvanrossum commented on Oct 8, 2022

    @gvanrossum
    Member

    Thanks for the fix!

    I don't think we should backport this (not even to 3.11.1).

  7. Repository owner moved this from Todo to Done in asyncioon Oct 8, 2022
  8. added a commit that references this issue on Oct 11, 2022
  9. serhiy-storchaka commented on Sep 25, 2023

    @serhiy-storchaka
    Member

    This test fails if run separately. See #109862.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions