GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — asyncio.Runner+PidfdChildWatcher leaves zombie processes · Issue #95899 · python/cpython

asyncio.Runner+PidfdChildWatcher leaves zombie processes #95899

New issue
Copy link
New issue
Copy link
Closed
Closed
asyncio.Runner+PidfdChildWatcher leaves zombie processes#95899
Copy link
Assignees
kumaraditya303
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@kumaraditya303
kumaraditya303
opened on Aug 11, 2022
Issue body actions
import asyncio
import sys
import unittest

import asyncio

asyncio.set_child_watcher(asyncio.PidfdChildWatcher())


def create_free_port():
    return 4  # chosen by a fair dice roll


class TestProc(unittest.IsolatedAsyncioTestCase):
    async def asyncSetUp(self):
        self.port = create_free_port()
        self.proc = await asyncio.create_subprocess_exec(
            sys.executable,
            "-c",  # more realistically this might be an http server or database
            f"import time; print('listening on {self.port}'); import time; time.sleep(2); print('goodbye')",
        )

    async def testProc(self):
        print(f"connecting to {self.port}")

    async def asyncTearDown(self):
        await self.proc.communicate()  # hangs forever on 3.11


if __name__ == "__main__":
    unittest.main()

on python3.10 this produces:

connecting to 4
listening on 4
goodbye
.
----------------------------------------------------------------------
Ran 1 test in 2.022s

OK

on python3.11 it hangs forever in await self.proc.communicate()

Originally posted by @graingert in #95736 (comment)

Activity

  1. kumaraditya303
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    topic-asyncio
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    on Aug 11, 2022
  2. kumaraditya303
    self-assigned this
    on Aug 11, 2022
  3. graingert commented on Aug 11, 2022

    @graingert
    graingert
    on Aug 11, 2022
    Contributor
    More actions

    #94184 would fix this specific combination. I suspect any ChildWatcher that implements attach_loop would be broken

  4. gvanrossum
    changed the title [-]asyncio.Runner+PidFdChildWatcher leaves zombie processes[/-] [+]asyncio.Runner+PidfdChildWatcher leaves zombie processes[/+] on Aug 12, 2022
  5. gvanrossum commented on Aug 12, 2022

    @gvanrossum
    gvanrossum
    on Aug 12, 2022
    Member
    More actions

    Why the nonsense with self.port? It does not contribute to understanding the repro but adds useless detail that the reader has to understand before being able to ignore.

  6. miss-islington
    added a commit that references this issue on Aug 15, 2022

    pythonGH-95899: fix asyncio.Runner to call set_event_loop only once (p…

    d500d1a
  7. gvanrossum
    added 2 commits that reference this issue on Aug 15, 2022

    GH-95899: fix asyncio.Runner to call set_event_loop only once (#95900)

    914f636

    GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900…

    8bd7a0b
  8. gvanrossum
    closed this as completedon Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @kumaraditya303
    kumaraditya303

Labels

3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.