Gzip Gunzip: always flush busy bufs when the incoming chain is NULL.

Yichun Zhang (agentzh) agentzh at gmail.com
Sat Nov 1 01:20:18 UTC 2014


# HG changeset patch
# User Yichun Zhang <agentzh at gmail.com>
# Date 1414804249 25200
#      Fri Oct 31 18:10:49 2014 -0700
# Node ID 38a74e59f199edafad0a8caae5cfc921ab3302e8
# Parent  dff86e2246a53b0f4a61935cd5c8c0a0f66d0ca2
Gzip Gunzip: always flush busy bufs when the incoming chain is NULL.

After the system send buffer is full, NULL incoming chains are used to
flush pending output upon new write events. The current gzip and gunzip
filters may intercept NULL chains and keep the data stalling in
nginx's own send buffers, leading to request hanging (until send
timeout).

This regression had appeared in nginx 1.7.7.

diff -r dff86e2246a5 -r 38a74e59f199
src/http/modules/ngx_http_gunzip_filter_module.c
--- a/src/http/modules/ngx_http_gunzip_filter_module.c Mon Aug 25
13:41:31 2014 +0400
+++ b/src/http/modules/ngx_http_gunzip_filter_module.c Fri Oct 31
18:10:49 2014 -0700
@@ -200,7 +200,7 @@ ngx_http_gunzip_body_filter(ngx_http_req
         }
     }

-    if (ctx->nomem) {
+    if (ctx->nomem || in == NULL) {

         /* flush busy buffers */

diff -r dff86e2246a5 -r 38a74e59f199
src/http/modules/ngx_http_gzip_filter_module.c
--- a/src/http/modules/ngx_http_gzip_filter_module.c Mon Aug 25
13:41:31 2014 +0400
+++ b/src/http/modules/ngx_http_gzip_filter_module.c Fri Oct 31
18:10:49 2014 -0700
@@ -373,7 +373,7 @@ ngx_http_gzip_body_filter(ngx_http_reque
         r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
     }

-    if (ctx->nomem) {
+    if (ctx->nomem || in == NULL) {

         /* flush busy buffers */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gzip_gunzip_flush.patch
Type: text/x-patch
Size: 1541 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20141031/04cd6f02/attachment.bin>


More information about the nginx-devel mailing list