SelectorEventLoop required, instead got uvloop.Loop
Hey all. Not sure if this should go in the Ansible project or the main Funkwhale one, but I'm putting it here because I am experiencing this issue when installing with Ansible. Haven't tried a regular package just yet, but figured I'd log here nonetheless.
Last night I used the Ansible script to set up Funkwhale, and it looked like everything worked. I had to tear down that instance though due to unrelated issues, so today I spun up a new instance of Ubuntu 20.04 to reinstall Funkwhale on. These are fresh servers, all up to date, nothing else set up. When I run the ansible script according to the docs, it completes normally but attempting to reach the website returns a 502 Bad Gateway. This is because the funkwhale-server is crashing, and throwing the following error in the journalctl logs.
Started Funkwhale application server.
[2021-02-28 18:12:34 +0000] [1010] [INFO] Starting gunicorn 20.0.4
[2021-02-28 18:12:34 +0000] [1010] [INFO] Listening at: http://127.0.0.1:5000 (1010)
[2021-02-28 18:12:34 +0000] [1010] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2021-02-28 18:12:34 +0000] [1022] [INFO] Booting worker with pid: 1022
2021-02-28 18:12:35,080 funkwhale_api.config INFO Loaded env file at /srv/funkwhale/config/.env
2021-02-28 18:12:35,081 funkwhale_api.config INFO Running with the following plugins enabled: funkwhale_api.contrib.scrobbler
[2021-02-28 18:12:35 +0000] [1022] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/uvicorn/workers.py", line 62, in init_process
super(UvicornWorker, self).init_process()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/srv/funkwhale/api/config/asgi.py", line 8, in <module>
django.setup()
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/channels/apps.py", line 6, in <module>
import daphne.server
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/daphne/server.py", line 20, in <module>
asyncioreactor.install(twisted_loop)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/twisted/internet/asyncioreactor.py", line 307, in install
reactor = AsyncioSelectorReactor(eventloop)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/twisted/internet/asyncioreactor.py", line 60, in __init__
raise TypeError(
TypeError: SelectorEventLoop required, instead got: <uvloop.Loop running=False closed=False debug=False>
[2021-02-28 18:12:35 +0000] [1022] [INFO] Worker exiting (pid: 1022)
[2021-02-28 18:12:35 +0000] [1010] [INFO] Shutting down: Master
[2021-02-28 18:12:35 +0000] [1010] [INFO] Reason: Worker failed to boot.
funkwhale-server.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
funkwhale-server.service: Failed with result 'exit-code'.
This is blocking me from being able to run Funkwhale at the moment, and I've tried on fresh servers multiple times including one on Debian. Looking up the error that is being thrown led me to this ticket, which references a commit made back in September: https://twistedmatrix.com/trac/ticket/10039
Twisted is a dependency for Daphne which is a dependency for Django Channels. Twisted got a new release this morning, which might point to why this is failing today where it worked yesterday. I might be able to pin a previous version as a workaround, but haven't tried it yet.