New submission from rogpeppe <rogpe...@gmail.com>:

If some parent process has disabled SIGCHLD, that signal is inherited and stops 
that signal being delivered, which means that asyncio.Process.wait will never 
complete.

As an example, the plan9port terminal window, 9term, 
(https://9fans.github.io/plan9port/man/man1/9term.html) does this, and hence 
causes async Python processes to hang forever.

Python should probably code defensively against this and ensure that SIGCHLD is 
enabled regardless. Attached is some C code that demonstrates the issue when 
the following python code is saved to "tst.py".

    #!/usr/bin/env python3
    import asyncio
    
    async def do_exec():
        cmd = ['echo', 'hello, world']
        process = await asyncio.create_subprocess_exec(*cmd, env={})
        await process.wait()
    
    loop=asyncio.get_event_loop()
    try:
        loop.run_until_complete(do_exec())
    finally:
        loop.close()



demonstration of the issue.

----------
components: asyncio
files: tst.c
messages: 306745
nosy: rogpeppe, yselivanov
priority: normal
severity: normal
status: open
title: Ignored SIGCHLD causes asyncio.Process.wait to hang forever
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file47283/tst.c

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to