INSPECTOR worker may handle HTTP request unexpectly when Sanic.start_method="fork"
and INSPECTOR=True
#2897
Labels
Sanic.start_method="fork"
and INSPECTOR=True
#2897
Is there an existing issue for this?
Describe the bug
When I set Sanic's
start_method
tofork
and enableINSPECTOR
, the HTTP requests I send may unexpectedly be processed by theINSPECTOR
worker process.Could this be because the webserver socket inherited from the parent process is not closed when forking the child process?
If there are any suggestions, or if this behavior is expected, please let me know. Thank you to all the excellent library developers.
Code snippet
test server code:
running server and sending HTTP request:
Socket fd of inspector worker:
lsof -p 1199437 | grep LISTEN python 1199437 user 12u IPv4 24318245 0t0 TCP localhost:http-alt (LISTEN) python 1199437 user 15u IPv4 24311762 0t0 TCP localhost:6457 (LISTEN)
Socket fd of normal worker:
lsof -p 1199435 | grep LISTEN python 1199435 tusen 12u IPv4 24318245 0t0 TCP localhost:http-alt (LISTEN)
Expected Behavior
inspector worker should not handle regular HTTP requests
How do you run Sanic?
Sanic CLI Python3.8.10
Operating System
Ubuntu 20.04
Sanic Version
Sanic 23.12.0; Routing 23.12.0
Additional context
No response
The text was updated successfully, but these errors were encountered: