bugfix: applied the patch to fix a new regression in nginx 1.7.7's ngx_gzip and ngx_gunzip modules that could lead to request hang when the downstream is slow to write to.

This commit is contained in:
Yichun Zhang (agentzh) 2014-10-31 18:18:38 -07:00
parent 46a5fd3bba
commit b6d3a5cf7b
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# HG changeset patch
# User Yichun Zhang <agentzh@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 */

View File

@ -277,6 +277,13 @@ if [ "$answer" = "N" ]; then
echo
fi
answer=`$root/util/ver-ge "$main_ver" 1.7.7`
if [ "$answer" = "Y" ]; then
echo "$info_txt applying the gzip_gunzip_flush patch for nginx"
patch -p1 < $root/patches/nginx-$main_ver-gzip_gunzip_flush.patch || exit 1
echo
fi
rm -f *.patch || exit 1
cd .. || exit 1