[PATCH] ngx_gzip might hang the request for slow downstreams

Maxim Dounin mdounin at mdounin.ru
Mon Oct 28 21:02:31 UTC 2013


Hello!

On Sun, Oct 27, 2013 at 03:03:03PM -0700, Yichun Zhang (agentzh) wrote:

> Hello!
> 
> On Sun, Oct 27, 2013 at 4:14 AM, Maxim Dounin wrote:
> >>          ctx->nomem = 0;
> >> +
> >> +        if (in == NULL) {
> >> +            return rc;
> >> +        }
> >>      }
> >>
> >>      for ( ;; ) {
> >
> > If there are pending data in ctx->in, they won't be handled.
> >
> 
> Thank you for the catch! Updated my patch accordingly:
> 
> --- nginx-1.4.3/src/http/modules/ngx_http_gzip_filter_module.c
> 2013-10-08 05:07:14.000000000 -0700
> +++ nginx-1.4.3-patched/src/http/modules/ngx_http_gzip_filter_module.c
> 2013-10-27 14:53:49.723406912 -0700
> @@ -370,7 +370,7 @@ ngx_http_gzip_body_filter(ngx_http_reque
>          }
>      }
> 
> -    if (ctx->nomem) {
> +    if (ctx->nomem || in == NULL) {
> 
>          /* flush busy buffers */

Is the same problem exists in the gunzip filter, which has very 
similar code?  Is a similar patch needed there?

And, BTW, do you care to provide a Mercurial changeset, as 
suggested by nginx.org/en/docs/contributing_changes.html?  It's 
not something required, but will make sure your name will be kept 
in history as a proper person to blame.  :)

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list