Open jcoleman-techempower opened 5 years ago
(This is in a Docker environment. I haven't tested it locally)
hug-gunicorn: [2018-12-28 01:34:44 +0000] [10] [INFO] Starting gunicorn 19.9.0 hug-gunicorn: [2018-12-28 01:34:44 +0000] [10] [INFO] Listening at: http://0.0.0.0:8080 (10) hug-gunicorn: [2018-12-28 01:34:44 +0000] [10] [INFO] Using worker: meinheld.gmeinheld.MeinheldWorker hug-gunicorn: [2018-12-28 01:34:44 +0000] [13] [INFO] Booting worker with pid: 13 hug-gunicorn: [2018-12-28 01:34:44 +0000] [14] [INFO] Booting worker with pid: 14 hug-gunicorn: [2018-12-28 01:34:45 +0000] [15] [INFO] Booting worker with pid: 15 hug-gunicorn: [2018-12-28 01:34:45 +0000] [16] [INFO] Booting worker with pid: 16 hug-gunicorn: [2018-12-28 01:34:45 +0000] [13] [ERROR] Exception in worker process hug-gunicorn: Traceback (most recent call last): hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker hug-gunicorn: worker.init_process() hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process hug-gunicorn: self.load_wsgi() hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi hug-gunicorn: self.wsgi = self.app.wsgi() hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi hug-gunicorn: self.callable = self.load() hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load hug-gunicorn: return self.load_wsgiapp() hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp hug-gunicorn: return util.import_app(self.app_uri) hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app hug-gunicorn: __import__(module) hug-gunicorn: File "/hug/app.py", line 1, in <module> hug-gunicorn: import hug hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/hug/__init__.py", line 35, in <module> hug-gunicorn: from hug import (authentication, directives, exceptions, format, input_format, introspect, hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/hug/route.py", line 27, in <module> hug-gunicorn: import hug.api hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/hug/api.py", line 37, in <module> hug-gunicorn: from hug._async import asyncio, ensure_future hug-gunicorn: File "/usr/local/lib/python3.7/site-packages/hug/_async.py", line 30 hug-gunicorn: ensure_future = asyncio.async # pragma: no cover hug-gunicorn: ^
Here's my Dockerfile
FROM python:3.7.2-stretch WORKDIR /hug COPY app.py app.py COPY gunicorn_conf.py gunicorn_conf.py COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt CMD ["gunicorn", "app:__hug_wsgi__", "-c", "gunicorn_conf.py"]
And here's my gunicorn_conf.py
gunicorn_conf.py
import multiprocessing import os import sys workers = multiprocessing.cpu_count() * 2 + 1 bind = "0.0.0.0:8080" keepalive = 120 worker_class = "meinheld.gmeinheld.MeinheldWorker" def post_fork(server, worker): # Disalbe access log import meinheld.server meinheld.server.set_access_logger(None)
Using uWSGI does not result in these issues
(This is in a Docker environment. I haven't tested it locally)
Here's my Dockerfile
And here's my
gunicorn_conf.py