[PATCH] ngx_gzip might hang the request for slow downstreams

Yichun Zhang (agentzh) agentzh at gmail.com
Sat Oct 26 05:59:44 UTC 2013


On Fri, Oct 25, 2013 at 10:55 PM, Yichun Zhang (agentzh) wrote:
> This is triggered by my own (3rd-party) module, ngx_lua. This module
> provides a ngx.flush(true) API function that flushes out all pending
> output data and *wait* (nonblockingly) until all outputs are *indeed*
> flushed out (into the system socket send buffer):
>     https://github.com/chaoslawful/lua-nginx-module#ngxflush

Sorry, I pressed the mail send button too fast. Below are some more details:

Under the hood, it sends out a special buf with ->flush set and then
checks the return value of the output filter chain. If it is
NGX_AGAIN, then wait for the next write event. Upon a new write event,
call ngx_http_output_filter(r, NULL) to flush out the output and check
r->connection->buffered to see if there's still any pending data.

Is this the right way to do this? If not, do you have any suggestions?


More information about the nginx-devel mailing list