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

Cannot properly close terminated process #79720

Closed
hniksic mannequin opened this issue Dec 19, 2018 · 2 comments
Closed

Cannot properly close terminated process #79720

hniksic mannequin opened this issue Dec 19, 2018 · 2 comments
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes topic-asyncio

Comments

@hniksic
Copy link
Mannequin

hniksic mannequin commented Dec 19, 2018

BPO 35539
Nosy @hniksic, @asvetlov, @1st1
Files
  • terminate.py
  • 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 = None
    created_at = <Date 2018-12-19.20:35:51.984>
    labels = ['3.7', 'expert-asyncio']
    title = 'Cannot properly close terminated process'
    updated_at = <Date 2018-12-19.20:35:51.984>
    user = 'https://github.com/hniksic'

    bugs.python.org fields:

    activity = <Date 2018-12-19.20:35:51.984>
    actor = 'hniksic'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['asyncio']
    creation = <Date 2018-12-19.20:35:51.984>
    creator = 'hniksic'
    dependencies = []
    files = ['48008']
    hgrepos = []
    issue_num = 35539
    keywords = []
    message_count = 1.0
    messages = ['332165']
    nosy_count = 3.0
    nosy_names = ['hniksic', 'asvetlov', 'yselivanov']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue35539'
    versions = ['Python 3.7']

    @hniksic
    Copy link
    Mannequin Author

    hniksic mannequin commented Dec 19, 2018

    It seems impossible to correctly close() an asyncio Process on which terminate has been invoked. Take the following coroutine:

    async def test():
        proc = await asyncio.create_subprocess_shell(
            "sleep 1", stdout=asyncio.subprocess.PIPE)
        proc.terminate()
        await proc.wait()

    After running it with asyncio.run(), Python prints a warning about "Event loop is closed" exception ignored in BaseSubprocessTransport.__del__. The code does wait for the process to exit, and neither proc nor proc.stdout have a close() method, so the warning seems spurious.

    Commenting out proc.terminate() makes the program finish without an exception (but then it waits for a full second, of course).

    Runnable example attached.

    @hniksic hniksic mannequin added 3.7 (EOL) end of life topic-asyncio labels Dec 19, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @kumaraditya303 kumaraditya303 added 3.11 only security fixes 3.10 only security fixes 3.12 bugs and security fixes and removed 3.7 (EOL) end of life labels May 20, 2022
    @kumaraditya303
    Copy link
    Contributor

    Duplicate of #88050

    @kumaraditya303 kumaraditya303 marked this as a duplicate of #88050 Jul 7, 2022
    @kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes topic-asyncio
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant