-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Describe the bug
Gunicorn worker crashes on init when it tries to close event loop. Happens only in python 3.14, works correctly in 3.13
To Reproduce
- Implement a simple server:
from aiohttp import web
async def index(request):
return web.Response(text="Welcome home!")
async def my_web_app():
app = web.Application()
app.router.add_get('/', index)
return app- Run it with gunicorn:
gunicorn my_app_module:my_web_app --bind localhost:8080 --worker-class aiohttp.GunicornWebWorkerExpected behavior
Server starts up
Logs/tracebacks
Traceback (most recent call last):
File ".../env314t/lib/python3.14t/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
worker.init_process()
~~~~~~~~~~~~~~~~~~~^^
File ".../env314t/lib/python3.14t/site-packages/aiohttp/worker.py", line 52, in init_process
asyncio.get_event_loop().close()
~~~~~~~~~~~~~~~~~~~~~~^^
File ".../.local/share/uv/python/cpython-3.14.0+freethreaded-linux-x86_64-gnu/lib/python3.14t/asyncio/events.py", line 715, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.Python Version
Python 3.14.0taiohttp Version
aiohttp 3.13.1multidict Version
multidict 6.7.0propcache Version
propcache 0.4.1yarl Version
yarl 1.22.0OS
Ubuntu 22.04
Related component
Server
Additional context
gunicorn 23.0.0
Code of Conduct
- I agree to follow the aio-libs Code of Conduct