通道会减慢应用程序速度并产生许多 HTTP 500 错误

发布于 2025-01-14 19:35:20 字数 1155 浏览 1 评论 0原文

我使用 channels 通知我的应用程序的前端强制页面更新。我发现,现在在调试模式下速度要慢得多,而且我的网络控制台中有大量的 HTTP 500。

有时我会得到以下结果:

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

而且所有 HTTP 500 错误通常都是一些无法加载的资源 - 图标和其他静态文件。加载页面可能会永远持续下去,但我记得有一段时间它工作得很好。我正在使用 django-eventstream 来创建我的频道。

我如何找出是什么拖慢了我的速度,或者如何阻止它?我的问题(可能)与此类似: Django 和 Channels 以及 ASGI 线程问题

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文