<div dir="ltr"><div>Configure:<br></div><div> ./configure --with-http_spdy_module --with-http_stub_status_module --prefix=$(pwd)/../nginx --with-cc-opt=-O0</div><div><br></div><div>Reproduce:</div><div>1. use nginx(spdy/2) to build static file server</div>
<div>2. request large static file(16MB file, 10 streams in one session)</div><div> $ spdycat --no-tls -2 -m 10 http://ip:spdy_port/16M_static_file</div><div>3. input ctrl-c to abort connection before spdycat exit</div><div>
4. see output of stub status module</div><div> $ curl http://ip:http_port/stub_status</div><div> Active connections: 2 <<< always larger than 1, one connection leak</div><div> server accepts handled requests</div>
<div> 4 4 4</div><div> Reading: 0 Writing: 2 Waiting: 1</div><div>Note: If you cannot reproduce, try one more time.</div><div><br></div><div>gdb trace:</div><div>-> ngx_http_spdy_read_handler</div><div> ...</div>
<div> do {</div><div> recv()</div><div> do {</div><div> sc->handler(sc, p, end)</div><div> } while</div><div> } while</div><div> ->sc->handler()</div><div> -> ... </div><div> -> ngx_http_spdy_send_output_queue()</div>
<div> -> c->send_chain(c, cl, 0); <<< (maybe) not send total chains</div><div> </div><div> stream->request->connection->write->handler = ngx_http_request_handler</div><div> stream->request->write_event_handler = ngx_http_writer</div>
<div><br></div><div>>>> client aborted the connection <<<</div><div><br></div><div>-> ngx_http_spdy_read_handler</div><div> ...</div><div> do {</div><div> rc = recv()</div><div> if (rc == 0) <<< Client closed the connection.</div>
<div> ngx_http_spdy_finalize_connection()</div><div> } while</div><div> ...</div><div> -> ngx_http_spdy_finalize_connection</div><div> -> ev->handler</div><div> (stream->request->connection->write->handler)</div>
<div> ngx_http_request_handler</div><div> -> r->write_event_handler</div><div> ngx_http_writer</div><div> ...</div><div> if (wev->delayed || r->aio) { <<< wev->delayed was set.</div>
<div> ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,</div><div> "http writer delayed");</div><div><br></div><div> if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {</div>
<div> ngx_http_close_request(r, 0);</div><div> }</div><div><br></div><div> return;</div><div> }</div><div> ...</div><div><br></div><div> In which case, this stream had not been finalized, and sc->processing was not decreased.</div>
<div> After ngx_http_spdy_finalize_connection(), nginx got one connection(spdy session) leak.</div><div><br></div><div><br></div></div>