[Errno 9] Bad file descriptor when run multi workers with multiprocessing module #1602
Answered
by
Kludex
jmkim
asked this question in
Potential Issue
Replies: 2 comments 2 replies
-
uvicorn/uvicorn/_subprocess.py Lines 67 to 71 in 6cf6aba Skipping the line 70 in This is a temporary fix, I do not know the purpose of that line. Please let me know the effect of this. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jmkim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am having an issue when I use Uvicorn with Python
multiprocessing
module. When I set the number of worker to multiple (2+), then[Errno 9] Bad file descriptor
error has been occur.Issue
Let's assume that run this simple sample app using
uvicorn
:Code 1: sample app
This app works well with Code 2 when I use
uvicorn
solely:Code 2: uvicorn (working)
Now I rewrote Code 2 to Code 3. They have same semantics. The difference is it has
multiprocessing
.Code 3: uvicorn + multiprocessing (not working)
Code 3 works well with single worker.
However, it gets failure when the number of workers goes higher (2+).
Error message shown by Code 3:
Diagnostic snippets
Beta Was this translation helpful? Give feedback.
All reactions