-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Subprocess launched in Uvicorn worker always returns zero exit code #584
Comments
seems to work fine with the following
|
No, I wasn’t able to launch the ASGI app because I didn’t create it, but that wasn’t the point. The point is that the |
Taking aside this makes no sense to do such things, what you experience I think is a misuse of subprocess, should you use the higher level api
|
It turns out that quite a bunch of libraries perform that call by using the If Popen does not work correctly, uvicorn turns out to be incompatible with such libraries, for instance. |
@euri10 also, in the example you posted above with I believe that Uvicorn workers do not handle PIPEs right... Even though I have no idea why. |
I have tried Gunicorn with other async worker (aiohttp's) and the exact same bug arises. I believe it happens because of the combination of I believe this is not Uvicorn's fault, so I will close this issue for now. Sorry for the inconvenience. |
@julioasotodv |
For everybody having the same issue, I solved the problem by using proc = subprocess.Popen("mkdir", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
See also #895 |
Hi everyone, I am facing one of those little bugs that almost seem impossible to happen (at least IMHO):
Imagine that I have the following "ASGI server app" (
server.py
), in which I want to make a call to a bash command usingsubprocess.Popen
(I know, there is no ASGI app, but this is just an example):And we run our "app" with:
The exit code result of
subprocess.Popen
is always 0, even though it shouldn't. The output is:However, if I just use Gunicorn's default
sync
workers:The return code is the right one:
Is there any reason why Uvicorn's Gunicorn worker always return zero exit code from
subprocess.Popen
?I know it is a weird thing to do, but I actually need a bash call inside the Uvicorn workers.
Thank you!
The text was updated successfully, but these errors were encountered: