pgjones / hypercorn

Hypercorn is an ASGI and WSGI Server based on Hyper libraries and inspired by Gunicorn.
MIT License
1.11k stars 102 forks source link

Hypercorn processes daemon property fails multiprocessing.Process / concurrent.futures.ProcessPoolExecutor #245

Open umairanis03 opened 2 months ago

umairanis03 commented 2 months ago

Hypercorn worker processes are by default run with daemon set (ref). This prevents APIs like multiprocessing.Process / concurrent.futures.ProcessPoolExecutor from creating children processes from inside the application.

  ...  File "<decorator-gen-995>", line 4, in wrapped_function_illegal_multiprocessing
  ...  File "/codemill/asthanas/dpi/sample.py", line 94, in illegal_multiprocessing
    daemon_process.start()
  File "/opt/python/python-3.11/lib64/python3.11/multiprocessing/process.py", line 118, in start
    assert not _current_process._config.get('daemon'), \

AssertionError:daemonic processes are not allowed to have children

Is there any reason why worker processes need to be daemonized or if this flag could be configured? Note that, this is not the case with application servers like uWSGI or uvicorn.

rafalkrupinski commented 2 months ago

is it different from #191 ?