You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I've been having problems with a python-uvloop process which is run from a container and spawns child processes. If those child processes spawn their own children which lose their parents (eg. via demonize()) then there's no way to reap them (as PID1 is honour-bound to do). I had been addressing this by patching libuv to do something analagous to FastChildWatcher - ie. reap all process in SIGCHLD handler. But this isn't really safe and can interfere with other libraries or modules (eg. a synchronous process start in another python module).
In the mean time, Python itself has deprecated child-watchers and is now using pidfd on Linux, and a dedicated wait() thread in all other cases.
This means that PID-1 programs can just install their own SIGCHLD handler to reap orphaned processes.
I was wondering if my proposal over on libuv/libuv#4179 might be of interest here? The idea would be to pass a special flag to libuv to tell it not to install a signal handler, and then use the python child watchers to handle reaping of libuv spawned processes.
Without this, a python process which sets up a SIGCHLD handler is going to break if switching from asyncio to uvloop (ie. the switch is no longer transparent, as of python 3.12)
The text was updated successfully, but these errors were encountered:
Hi,
So I've been having problems with a python-uvloop process which is run from a container and spawns child processes. If those child processes spawn their own children which lose their parents (eg. via
demonize()
) then there's no way to reap them (as PID1 is honour-bound to do). I had been addressing this by patching libuv to do something analagous to FastChildWatcher - ie. reap all process inSIGCHLD
handler. But this isn't really safe and can interfere with other libraries or modules (eg. a synchronous process start in another python module).In the mean time, Python itself has deprecated child-watchers and is now using pidfd on Linux, and a dedicated
wait()
thread in all other cases.This means that PID-1 programs can just install their own
SIGCHLD
handler to reap orphaned processes.I was wondering if my proposal over on libuv/libuv#4179 might be of interest here? The idea would be to pass a special flag to
libuv
to tell it not to install a signal handler, and then use the python child watchers to handle reaping of libuv spawned processes.Without this, a python process which sets up a
SIGCHLD
handler is going to break if switching fromasyncio
touvloop
(ie. the switch is no longer transparent, as of python 3.12)The text was updated successfully, but these errors were encountered: