今天同事反映样本系统导出用户信息的时候报告 504:
![](https://img.haomeiwen.com/i5155564/850b468b819edf19.png)
首先定位 nginx 响应超时了
location / {
uwsgi_pass unix:///opt/zk/script/uwsgi.sock;
include /etc/nginx/uwsgi_params;
# 新增下面三行
uwsgi_connect_timeout 300;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
}
然后错误就变成了 502 :(
![](https://img.haomeiwen.com/i5155564/9f40a84b455952c7.jpg)
mmd
502 只能忘下一层寻找了... 进入 uwsgi 查找问题咯
Sun May 5 10:40:02 2019 - *** HARAKIRI ON WORKER 3 (pid: 4076, try: 1) ***
Sun May 5 10:40:02 2019 - HARAKIRI !!! worker 3 status !!!
Sun May 5 10:40:02 2019 - HARAKIRI [core 0] 223.113.6.13 - POST /admin/infosystem/sample/export/?receive_date__month=4&receive_date__year=2019 since 1557023941
Sun May 5 10:40:02 2019 - HARAKIRI !!! end of worker 3 status !!!
[pid: 29699|app: 0|req: 4000/19953] 223.113.6.13 () {44 vars in 1139 bytes} [Sun May 5 10:40:02 2019] GET /admin/infosystem/report/?q=%E6%9D%8E%E5%BB%BA%E6%96%B0&upload_date__month=4&upload_date__year=2019 => generated 103437 bytes in 900 msecs (HTTP/1.1 200) 7 headers in 383 bytes (1 switches on core 0)
DAMN ! worker 3 (pid: 4076) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 3 (new pid: 8864)
uwsgi 日志发现是 uwsgi超时把进程杀掉了, 更改uwsgi 配置:
# 设置自中断时间
harakiri=300
# 设置缓冲
post-buffering=6553600
然后还是错误, 但是错误不一样了, 这说明革命路线没有走错. 继续看日志:
SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request
uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during POST
这个.... 可能还是 uwsgi 的问题吧, 反正是超时的问题. 翻看uwsgi 手册.发现 http-timeout
这个参数可能有用 那就写上呗: http-timeout=600
重启应用, 哎.................好了...哈哈哈哈哈哈
网友评论