Fwd: Problems with SSL + SPDY cause CLOSE_WAIT connections

Salvador Gironès Gil salvadorgirones at gmail.com
Tue Sep 10 11:00:30 UTC 2013


I know this appeared some time ago with first versions of SPDY, but we have
been using 1.4.1 SPDY in production and it is generating lots of CLOSE_WAIT

Doing some testing, I found reproducible steps and a possible patch.

Our env (listing what I think are relevant points, please ask for more if
you need it):
1. Nginx 1.4.1
3. Proxy-pass 443 port to a Rails app
3. Sendfile on

Steps to reproduce:
1. Perform a POST with a big body (I'm uploading a file)
2. Refresh the browser before the upload finishes
3. Close the browser

When the connection is closed due the browser close, the error.log (with
debug enabled) says:
*2013/09/10 10:02:53 [info] 4372#0:* *12 client closed prematurely
connection while processing SPDY, client:, server:
*2013/09/10 10:02:53 [debug] 4372#0:* *12 http reading blocked

And nothing else happens.

I tried to add a connection check inside *ngx_http_block_reading *based on *


    if (r->spdy_stream) {

        if (c->error) {
            err = 0;

            goto closed;


I'm checking if the spdy_stream is open before trying to read from it. It
converts the CLOSE_WAIT connections to TIME_WAIT and they do finalize after
some seconds.

I dig into nginx code yesterday, so I'm far from correctly understand where
the real problem is, but this "patch" seems reasonable to me.

Can someone with better nginx source code understanding, provide some

And thanks for all your work!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130910/fa1ea8fe/attachment.html>

More information about the nginx-devel mailing list