Re: debug points abort, что делать с корками

Maxim Dounin mdounin at mdounin.ru
Mon Dec 2 13:50:59 UTC 2013


Hello!

On Sat, Nov 30, 2013 at 04:18:47PM -0500, proforg wrote:

> Linux shc 3.6-trunk-amd64 #1 SMP Debian 3.6.8-1~experimental.1 x86_64
> GNU/Linux
> 
> nginx version: nginx/1.5.7
> built by gcc 4.4.5 (Debian 4.4.5-8)
> TLS SNI support enabled

[...]

> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 access phase: 9
> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 access phase: 10
> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 post access phase: 11
> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 http client request body
> preread 148
> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 http request body content
> length filter
> 2013/11/30 16:06:49 [debug] 17787#0: *4925169 http body new buf t:1 f:0
> 0000000000AE16BC, pos 0000000000AE16BC, size: 0 file: 0, size: 0

Понятно, при использовании pipelining'а в тело попадает пустой 
буфер, хотя не должен бы.  Плохого от этого быть не должно, но в 
целом ругань по делу.  Патч какой-то такой:

# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1385936263 -14400
#      Mon Dec 02 02:17:43 2013 +0400
# Node ID 591423596597056f214677ed48a874ec02306fb0
# Parent  eda7fcb44dcea02763a5ae2de771b51a1d3e428c
Fixed "zero size buf in output" alerts.

If request had an empty request body (with Content-Length: 0), and there
were preread data available (e.g., due to a pipelined request in buffer),
the "zero size buf in output" alert might be logged while proxying the
request to an upstream.

Similar alerts appeared with client_body_in_file_only if a request had an
empty request body.

diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -160,7 +160,7 @@ ngx_http_read_client_request_body(ngx_ht
 
             ngx_memzero(b, sizeof(ngx_buf_t));
 
-            b->in_file = 1;
+            b->in_file = (rb->temp_file->file.offset != 0);
             b->file_last = rb->temp_file->file.offset;
             b->file = &rb->temp_file->file;
 
@@ -384,7 +384,7 @@ ngx_http_do_read_client_request_body(ngx
 
         ngx_memzero(b, sizeof(ngx_buf_t));
 
-        b->in_file = 1;
+        b->in_file = (rb->temp_file->file.offset != 0);
         b->file_last = rb->temp_file->file.offset;
         b->file = &rb->temp_file->file;
 
@@ -843,6 +843,10 @@ ngx_http_request_body_length_filter(ngx_
 
     for (cl = in; cl; cl = cl->next) {
 
+        if (rb->rest == 0) {
+            break;
+        }
+
         tl = ngx_chain_get_free_buf(r->pool, &rb->free);
         if (tl == NULL) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;

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



Подробная информация о списке рассылки nginx-ru