1 year ago

#301896

test-img

xtlc

channels slows app and creates many HTTP 500 errors

I use channels to inform the frontend of my app to force a page update. What I discovered is, that it is much slower in debug mode now and also I have tons of HTTP 500 in my webconsole.

Occasionally I end up with:

ERROR:daphne.server:Exception inside application: Single thread executor already being used, would deadlock
Traceback (most recent call last):
  File "...\venv\lib\site-packages\channels\staticfiles.py", line 40, in __call__
    return await self.staticfiles_handler_class()(
  File "...\venv\lib\site-packages\channels\staticfiles.py", line 56, in __call__
    return await super().__call__(scope, receive, send)
  File "...\venv\lib\site-packages\channels\http.py", line 198, in __call__
    await self.handle(scope, async_to_sync(send), body_stream)
  File "...\venv\lib\site-packages\asgiref\sync.py", line 382, in __call__
    raise RuntimeError(
RuntimeError: Single thread executor already being used, would deadlock

And also all the HTTP 500 errors are usually some resources that can not be loaded - icons and other static files. Loading the page can last forever, but I remember for some time it worked just fine. I am using django-eventstream for creating my channels.

How would I find out what is slowing me down, or how can I prevent it? Is my problem (probably) similar to this one: Django and Channels and ASGI Thread Problem?

django

multithreading

django-channels

daphne

asgi

0 Answers

Your Answer

Accepted video resources