【问题标题】:Django + gunicorn timing out with POST requests with large sizesDjango + gunicorn 因 POST 请求而超时
【发布时间】:2021-12-19 18:59:51
【问题描述】:

向 gUnicorn 发送“大型”POST 请求会导致其冻结并最终超时。这在我的生产服务器和开发服务器(都运行 Ubuntu 20.04)上。 它只是在返回之前冻结

[CRITICAL] WORKER TIMEOUT (pid:10000)

Django 的默认开发服务器可以正常工作。

我的 WSGI 文件:

  import os    
  from django.core.wsgi import get_wsgi_application
  os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'djangoProject.settings')
  application = get_wsgi_application()

【问题讨论】:

  • 这能回答你的问题吗? Gunicorn worker timeout error
  • @MatthewHegarty 增加超时没有任何作用。它不记录任何内容或提供任何跟踪。

标签: python django django-rest-framework gunicorn


【解决方案1】:

试试这个(假设 180 秒超时就足够了):

  1. --timeout TIMEINSECONDS \ 添加到您的 guncicorn 配置文件中。
  2. 试试这些 nginx 配置文件选项。

Nginx 配置

server {
    keepalive_timeout 180s;
    send_timeout 180s;
    proxy_connect_timeout 180s;
    proxy_send_timeout 180s;
    proxy_read_timeout 180s;
    
    ...rest of the config
}

【讨论】:

    猜你喜欢
    • 2019-10-29
    • 2014-07-18
    • 2011-07-03
    • 2015-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多