I don't think a RST will be sent if uWSGI crashes or dies with SIGKILL - I did a sniff (on OSX) and saw FINs, not RSTs.
Also, since uWSGI knows when the WSGI application callable returned or has been exhausted (StopIteration), I think it can know whether or not the response is finished or not. So I still think it may not be a bad idea to add broken-connection protection to the uwsgi protocol, but I'll do as you recommended and have my application add Content-Length as necessary. Thanks, - Yaniv On Thu, Sep 29, 2011 at 7:30 AM, Roberto De Ioris <[email protected]> wrote: > > > Hi, > > > > I'm trying to debug a strange problem I've been seeing on my site: > > occasionally, I get weird errors reading dynamic content served to me via > > uwsgi/nginx. It appears that the response is cut in the middle, i.e., if > > there's an HTML that should be 1,000 bytes, I see only the first 500 > > bytes. > > > > This wouldn't trouble me so much, unless this page would enter the cache > > of > > my browser and appear to remain corrupt even after reloads. This only > > happened so far on my development setup, and only rarely, but I'm afraid > > it > > may happen to some of my users in production and I don't know about it. > > > > I now think the problem is that if the connection between uWSGI and nginx > > is > > interrupted in the middle of a uwsgi "HTTP" response with no > > content-length > > and no transfer-encoding, nginx has no way of knowing that it only has a > > partial response. It will then send the partial response it has to the > > client, along with any cache-control headers, letting the client cache > the > > bad response. > > > > I assume if the connection will be dropped because of a network problem > > (timeout/RST), nginx will be smart enough to ignore this response and > > return > > a 502/504 page. But what if uWSGI is killed/crashed (as sometimes happens > > on > > my development setup :)? > > > > > Same thing, a RST will be sent. > > By the way, as nginx, uWSGI has no way to know if a response is fully sent. > > If you want to be sure, "fix" your response adding the content-length (you > can use a middleware) > > > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
