-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Closed
Labels
Description
Describe the bug
Make a multiprocessing Process and start it.
Right after terminate the process, fastapi itself(parent) terminated.
To Reproduce
Start command: /usr/local/bin/uvicorn worker.stts_api:app --host 127.0.0.1 --port 8445
- Create a file with:
from fastapi import FastAPI
app = FastAPI()
@app.post('/task/run')
def task_run(task_config: TaskOptionBody):
proc = multiprocessing.Process(
target=task.run,
args=(xxxx,))
proc.start()
return task_id
@app.get('/task/abort')
def task_abort(task_id: str):
proc.terminate()
return result_OK- Run task_run and while the process alive, trigger task_abort
- After child process terminated then parent(fastApi) terminated as well.
Expected behavior
Parent process should not be terminated after child terminated.
Environment
- OS: Linux
- FastAPI Version 0.54.1
- Python version 3.8.2
Additional context
I tried same code with Flask with gunicorn, it never terminated.
Reactions are currently unavailable