Dealing with buffered data with upstream generated response
Umesh Sirsiwal
usirsiwal at verivue.com
Mon Nov 28 16:52:38 UTC 2011
I am developing a body filter which transforms outgoing stream. As part
of the function, the incoming stream is copied in new buffer and sent.
This in some cases results in a condition where my filter has busy
buffers but the upper layers don't have any busy buffer. In our case the
data is generated by upstream module. Since upstream module does not pay
attention to connection->buffered, the output_filter is never called
again to flush my busy buffers and the transfer just hangs.
Adding r->connection->buffered to the or condition solves the hang.
if (u->out_bufs || u->busy_bufs) {
rc = ngx_http_output_filter(r, u->out_bufs);
if (rc == NGX_ERROR) {
ngx_http_upstream_finalize_request(r, u, 0);
return;
}
ngx_chain_update_chains(&u->free_bufs, &u->busy_bufs,
&u->out_bufs, u->output.tag);
}
Is this nginx bug or am I missing something?
-Umesh
More information about the nginx
mailing list