<span style>We use nginx as both a load-balancer and webserver. This issue is with the nginx functioning as a load-balancer.</span><div style><br></div><div style>We reverse proxy to 6 nginx webservers running a number of Unicorn (Rails) application servers, these webserver nginx instances also run Evan Miller's mod_zip to assemble archives on the fly. We have discovered under certain circumstances the load-balancing nginx will "hang-up" on the webserver if the load-balancer is configured with proxy_buffering off, however proxy_buffering on seems to succeed. We would prefer to run without proxy_buffering to prevent the load-balancer's local storage from being overrun.</div>
<div style><br></div><div style>Our default setup uses nginx 0.7.65 for both the load-balancer and the webserver, however switching to using 1.0.12 as the load-balancer has the same problem. We have experimented with different software doing the load-balancing and it does not exhibit this issue.</div>
<div style><br></div><div style>I've have linked the nginx configuration file we're using on the load balancer, and debug logs for both 0.7.65 and 1.0.12.</div><div style><br></div><div style><font color="#222222" face="arial, sans-serif"><a href="https://x.onehub.com/transfers/sg32zsar">https://x.onehub.com/transfers/sg32zsar</a></font></div>
<div style><br></div><div style>The buffering on log is very long, but it does show success of a 4.8GB response, the other responses always fail at the same point (826 MB).</div><div style><br></div><div style>The client sees the following (in access.log):</div>
<div style><br></div><div style><div>$ curl -b cookie.txt -o US.zip <a href="https://mydomain.com/folders/7816672/archive" target="_blank" style="color:rgb(17,85,204)">https://mydomain.com/folders/7816672/archive</a></div>
<div>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current</div><div>                                 Dload  Upload   Total   Spent    Left  Speed</div><div> 16 4922M   16  826M    0     0  1906k      0  0:44:03  0:07:23  0:36:40 1075k</div>
<div>curl: (18) transfer closed with 4294967296 bytes remaining to read</div></div><div style><br></div><div style>The nginx instance serving as the webserver logs:</div><div style>Feb 07 15:03:39 ip-10-2-185-35 error.log:  2012/02/07 23:03:39 [info] 21425#0: *16656299 client closed prematurely connection, so upstream connection is closed too (104: Connection reset by peer) while reading upstream, client: 10.254.174.80, server: <a href="http://mydomain.com/" target="_blank" style="color:rgb(17,85,204)">mydomain.com</a>, request: "GET /folders/7816672/archive HTTP/1.0", subrequest: "/s3/asset-27235062", upstream: "<a href="http://72.21.215.100/bucket/asset-27235062?AWSAccessKeyId=key&Expires=1328741778&Signature=signature" target="_blank" style="color:rgb(17,85,204)">http://72.21.215.100:80/bucket/asset-27235062?AWSAccessKeyId=key&Expires=1328741778&Signature=signature</a>", host: "<a href="http://mydomain.com/" target="_blank" style="color:rgb(17,85,204)">mydomain.com</a>"</div>