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
subprocess.run internally does a os.waitpid(pid, wait_flags) call. Here pid is supposed to be the process ID of the command it executes (exit 1 in the MRE case). However in the MRE scenario above, the pid passed to waitpid is the gunicorn worker pid, which no longer exists. os.waitpid raises a ChildProcessError and subprocess sets the exit code to 0 when handling the exception.
I think this is might be solved by #3148, at least with the change-set that I primarily propose. At I didn't get the assert when trying it out with that.
Summary
OverflowError
raisedsubprocess.run
will always return exit code 0 regardless of the command passed to subprocessMRE
Environment
OS: Ubuntu 20.04.6
$ python --version Python 3.8.10 $ pip freeze | grep gunicorn gunicorn==21.2.0
Attempts at finding the root cause
I suspect this might have something to do with the improper cleanup of the signal handling steps done in
init_handlers
ofarbiter.py
I generated function call traces of the above MRE with and without the gunicorn section and did a simple
vimdiff
subprocess.run
internally does aos.waitpid(pid, wait_flags)
call. Herepid
is supposed to be the process ID of the command it executes (exit 1
in the MRE case). However in the MRE scenario above, the pid passed towaitpid
is the gunicorn worker pid, which no longer exists.os.waitpid
raises aChildProcessError
and subprocess sets the exit code to 0 when handling the exception.Maybe related issue: encode/uvicorn#894
The text was updated successfully, but these errors were encountered: