Im running Nginx + Gunicorn + FastAPI application. I have rather simple ML application in my file main.py.
I used this manual to set (Russian translate): [Развертывайте приложение Fastapi на Ubuntu с Nginx, Gunicorn и UVicorn][1]
When I'm trying to check
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
I see this error
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 211, in run
self.manage_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 551, in manage_workers
self.spawn_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 623, in spawn_workers
time.sleep(0.1 * random.random())
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
self.reap_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 530, in reap_workers
self.log.warning(
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/glogging.py", line 261, in warning
self.error_log.warning(msg, *args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1093, in emit
self.handleError(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1007, in handleError
traceback.print_exception(t, v, tb, None, sys.stderr)
File "/usr/lib/python3.8/traceback.py", line 105, in print_exception
print(line, file=file, end="")
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
self.reap_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 530, in reap_workers
self.log.warning(
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/glogging.py", line 261, in warning
self.error_log.warning(msg, *args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1093, in emit
self.handleError(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1006, in handleError
sys.stderr.write('--- Logging error ---\n')
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>
[2022-02-21 21:02:44 +0300] [650] [WARNING] Worker with pid 656 was terminated due to signal 4 ```
I have file main.py and app in it. Any ideas how to handle this error?
[1]: https://pythobyte.com/deploy-fastapi-application-on-ubuntu-with-nginx-gunicorn-and-uvicorn-3mbl-f789b2df/