emmett-framework / emmett

The web framework for inventors
Other
1.04k stars 70 forks source link

Broken loop init with gunicorn worker #299

Closed josejachuf closed 3 years ago

josejachuf commented 3 years ago

Hi @gi0baro

python3.8 emmett 2.1.3

myapp.py

from emmett import App

app = App(__name__)

@app.route("/")
async def hello():
    return "Hello world!"

gunicorn myapp:app -w 4 -k emmett.asgi.workers.EmmettWorker

when executing it with gunicorn this error occurs, tested in linux and freebsd

$ gunicorn myapp:app -w 4 -k emmett.asgi.workers.EmmettWorker [2020-11-06 15:34:12 -0300] [32099] [INFO] Starting gunicorn 20.0.4 [2020-11-06 15:34:12 -0300] [32099] [INFO] Listening at: http://127.0.0.1:8000 (32099) [2020-11-06 15:34:12 -0300] [32099] [INFO] Using worker: emmett.asgi.workers.EmmettWorker [2020-11-06 15:34:12 -0300] [32099] [INFO] Unhandled exception in main loop Traceback (most recent call last): File "/home/jose/borro/emmett-prod/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 202, in run self.manage_workers() File "/home/jose/borro/emmett-prod/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 545, in manage_workers self.spawn_workers() File "/home/jose/borro/emmett-prod/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 616, in spawn_workers self.spawn_worker() File "/home/jose/borro/emmett-prod/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 563, in spawn_worker worker = self.worker_class(self.worker_age, self.pid, self.LISTENERS, File "/home/jose/borro/emmett-prod/venv/lib/python3.8/site-packages/emmett/asgi/workers.py", line 64, in init http=protocols_http.get_protocol(config.get('http', 'auto')), AttributeError: 'Registry' object has no attribute 'get_protocol'

gi0baro commented 3 years ago

@josejachuf I confirm it's a bug due to internals changes between 2.0 and 2.1.

I'm quite disappointed by 2.1 release, I broke quite a lot of stuff u.u Gonna release a 2.1.4 in the next ~48hours, I'm sorry for the inconvenient

josejachuf commented 3 years ago

Thanks @gi0baro

gi0baro commented 3 years ago

This is now fixed both in master and 2.1.4