【问题标题】:Gunicorn + nginx - Ignoring EPIPEGunicorn + nginx - 忽略 EPIPE
【发布时间】:2019-09-10 02:14:27
【问题描述】:

我有一个在谷歌计算上运行的 nginx-gunicorn-flask 设置 我不断从 gunicorn 获得以下信息:

[2019-04-19 20:50:49 +0000] [3345] [DEBUG] POST /
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] Ignoring EPIPE

在 100 个请求中,大约有 23 个是这样出现的。在访问日志中只显示了 23 个请求,它们都是 200 个。

从 nginx 访问日志显示 504,在错误日志中我看到:

2019/04/19 20:50:49 [error] 3097#3097: *295 upstream timed out (110: Connection timed out) while sending request to upstream, client: ip, server: , request: "POST / HTTP/1.1", upstream: "http://unix:/home/user/Server/server.sock/", host: "ip"

我试过设置

proxy_connect_timeout 75s;
proxy_read_timeout 300s;

基于other questions 在gunicorn 中的nginx 和--timeout 300 上的位置,但它没有帮助。

来自 gunicorn 的消息并不能真正帮助确定原因,我没有找到任何相关信息

一段时间以来一直在尝试解决这个问题,如果有任何想法,我将不胜感激。此外,这些请求中的每一个都需要大约 1-2 秒,并且 jmeter 在结果出现之前会显示巨大的延迟。

查看 gunicorn 的代码,这是一个与套接字有关的 errno.EPIPE 异常...

【问题讨论】:

  • 我有同样的问题。我认为这是由于一些执行。
  • 您是否在同一主机上托管 Nginx 和应用服务器?你能展示你的 Nginx 和 Gunicorn 配置吗?
  • 有些相关(关于服务和 sigpipe 的主题):Hudson : “yes: standard output: Broken pipe”

标签: python nginx server gunicorn ubuntu-18.04


【解决方案1】:

如果GunicornNGINX 在同一台服务器上运行,这可能是权限问题。

使用ps aux | grep gunicorn检查Gunicorn服务器正在运行您的应用程序的用户,然后您可以相应地更改权限。

停止NGINX,然后运行以下命令

chown gunicorn_user_here.nginx /var/lib/nginx/tmp/proxy -v
rm /var/lib/nginx/tmp/proxy/* -R
chmod 777 /var/lib/nginx/tmp -v

启动NGINX 并检查日志。

【讨论】:

    【解决方案2】:

    我遇到了类似的问题和超时错误,除了增加超时值,添加 Nginx 配置 proxy_ignore_client_abort on; 检查这个 threadNginx doc

    proxy_ignore_client_abort on;
    

    【讨论】:

      【解决方案3】:

      在我的情况下,硬盘驱动器已满,这是导致问题的原因。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-02-21
        • 1970-01-01
        • 1970-01-01
        • 2013-03-25
        • 2013-03-01
        • 2021-02-24
        • 2012-03-27
        相关资源
        最近更新 更多