16👍
Either pip install 'asgiref==3.3.4'
if you’re remaining on channels
version 3, or upgrade to channels
version 4 (the issue is fixed in 4.0.0).
I noticed a similar RuntimeError: Single thread executor already being used, would deadlock
after upgrading from asgiref
3.3.4 to 3.4.1.
This appears to be due to an issue in channels
3.0.4 where concurrent requests on the Django development server are intermittently failing. See also Runtime Error Deadlock occurring randomly in Django.
In 3.4.0, asgiref
introduced additional deadlock checks. That’s a good thing, but may have exposed an underlying issue in channels. From the changelog:
* Calling sync_to_async directly from inside itself (which causes a deadlock
when in the default, thread-sensitive mode) now has deadlock detection.
If you do need to install asgiref >= 3.4.1, a workaround in development is to use python manage.py runserver --noasgi
. This also has the benefit of being a little faster to reload.