Nginx连接重置,uWsgi的响应丢失 [英] Nginx connection reset, response from uWsgi lost

查看:585
本文介绍了Nginx连接重置,uWsgi的响应丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过Nginx和uWsgi托管的django应用程序。在一个非常简单的请求中,我获得了GET和POST的不同行为,不应该是这样。



uWsgi守护进程日志:

  [pid:32454 | app:0 | req:5/17] 127.0.0.1(){36 vars in 636 bytes} [Tue Oct 19 11: 18:36 2010] POST / buy / 76d4f520ae82e1dfd35564aed64a885b / a_2 / 10 / =>在3 msecs(HTTP / 1.0 440)中生成80个字节(76个字节)中的1个标头(异步内核0上的0个异步开关)
[pid:32455 | app:0 | req:5/18] 127.0.0.1() {32 vars in 521 bytes} [Tue Oct 19 11:18:50 2010] GET / buy / 76d4f520ae82e1dfd35564aed64a885b / a_2 / 10 / =>在3 msecs(HTTP / 1.0 440)中生成80个字节(76字节)中的1个标头(异步核心0上的0个异步开关)

Nginx accesslog:

  127.0.0.1  -   -  [19 / Oct / 2010:18:18:36 +0200]POST / buy / 76d4f520ae82e1dfd35564aed64a885b / a_2 / 10 / HTTP / 1.0440 0 - curl / 7.19.5(i486-pc-linux-gnu)libcurl / 7.19.5 OpenSSL / 0.9.8g zlib / 1.2.3.3 libidn / 1.15
127.0.0.1 - - [19 / Oct / 2010:18:18:50 +0200]GET / buy / 76d4f520ae82e1dfd35564aed64a885b / a_2 / 10 / HTTP / 1.0440 80 curl / 7.19.5(i486-pc-linux-gnu)libcurl / 7.19.5 OpenSSL / 0.9.8g zlib / 1.2.3.3 libidn / 1.15

Nginx错误日志:

  2010/10/19 18:18 :36 [错误] 4615#0:* 5 readv()失败(104:由对等体重新连接)在上游读取时,客户端:127.0.0.1,服务器:localhost,请求:POST / buy / 76d4f520ae82e1dfd35564aed64a885b / a_2 / 10 / HTTP / 1.0,上游:uwsgi:// unix:sock / uwsgi.sock:,host:localhost:9201

如果我使用POST,Nginx会丢失响应,而不是使用GET。



有人知道这个吗?

解决方案

在进一步研究中幸运的发现之后(http://answerpot.com/showthread.php?577619-Several%20Bugs/Page2),我发现有帮助的东西..



在Nginx conf中提供 uwsgi_pass_request_body off; 参数解决了这个问题...


I have a django app hosted via Nginx and uWsgi. In a certain very simple request, I get different behaviour for GET and POST, which should not be the case.

The uWsgi daemon log:

[pid: 32454|app: 0|req: 5/17] 127.0.0.1 () {36 vars in 636 bytes} [Tue Oct 19 11:18:36 2010] POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ => generated 80 bytes in 3 msecs (HTTP/1.0 440) 1 headers in 76 bytes (0 async switches on async core 0)
[pid: 32455|app: 0|req: 5/18] 127.0.0.1 () {32 vars in 521 bytes} [Tue Oct 19 11:18:50 2010] GET /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ => generated 80 bytes in 3 msecs (HTTP/1.0 440) 1 headers in 76 bytes (0 async switches on async core 0)

The Nginx accesslog:

127.0.0.1 - - [19/Oct/2010:18:18:36 +0200] "POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0" 440 0 "-" "curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15"
127.0.0.1 - - [19/Oct/2010:18:18:50 +0200] "GET /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0" 440 80 "-" "curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15"

The Nginx errorlog:

2010/10/19 18:18:36 [error] 4615#0: *5 readv() failed (104: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: localhost, request: "POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0", upstream: "uwsgi://unix:sock/uwsgi.sock:", host: "localhost:9201"

In essence, Nginx somewhere loses the response if I use POST, not so if I use GET.

Anybody knows something about that?

解决方案

After a lucky find in further research (http://answerpot.com/showthread.php?577619-Several%20Bugs/Page2) I found something that helped...

Supplying the uwsgi_pass_request_body off; parameter in the Nginx conf resolves this problem...

这篇关于Nginx连接重置,uWsgi的响应丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆