Welcome! Log In Create A New Profile

Advanced

Re: zero size buf in output(Bug?)

Maxim Dounin
October 09, 2012 03:38PM
Hello!

On Tue, Oct 09, 2012 at 06:51:21PM +0400, Andrey Feldman wrote:

> Hi.
> After update from 1.0.14 to 1.2.3, strange alerts starts to appears in
> error.log:
> 2012/10/08 23:44:07 [alert] 25551#0: *79037 zero size buf in output
> t:0 r:0 f:0 000000000D31F3F0 000000000D31F3F0-000000000D3273F0
> 0000000000000000 0-0 while sending to client, client: 91.138.121.71,
> server: www.example.ru, request: "HEAD
> /images/one/video_player.swf?file=http://www.example.ru/test/generate_xml%3fpid=51559%26one=22
> HTTP/1.1", upstream:
> "http://10.23.23.15:6644/images/one/video_player.swf?file=http://www.example.ru/test/generate_xml%3fpid=51559%26one=22",
> host: "www.example.ru"
>
> We can't reproduce it in test environment(without real load). It
> appears on different servers with different CentOS versions on it.
> In most cases error appears after HEAD requests(by google bot, for example).
>
> We uses proxy_cache requests, config:
> proxy_cache_key "$request_method|$host|$uri?$args";
> proxy_cache_path /var/nginx/cache/html levels=1:2
> keys_zone=html-cache:18m max_size=5g inactive=60m;
> proxy_cache html-cache;
> proxy_cache_valid 200 302 301 10m;
> proxy_cache_valid 304 10m;
> proxy_cache_valid 404 1m;
> proxy_cache_use_stale updating timeout error http_502 http_503 http_500;
>
> So, when there's no file in cache path, and we made, for example, a
> HEAD request, in some cases it generates an error.
> Example with full debug in attachment.

Thank you for report. From debug log it's more or less clear what
goes on here, it indeed affects HEAD (as well as other header
only) requests while loading cache entry.

I'm able to reproduce it here with the following config:

location = /proxy {
proxy_pass http://127.0.0.1:8080/10m;
proxy_cache one;
proxy_cache_valid any 5s;
sendfile off;
output_buffers 1 1024;
}

It's more or less harmless (i.e. no bad things happen, worst one
is log entry).

Quick fix would be to do something like this:

--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2075,6 +2075,8 @@ ngx_http_upstream_send_response(ngx_http
r->write_event_handler = ngx_http_request_empty_handler;
c->error = 1;

+ u->pipe->downstream_error = 1;
+
} else {
ngx_http_upstream_finalize_request(r, u, rc);
return;

Though it probably needs more attention. I'll take a look as time
permits.

--
Maxim Dounin
http://nginx.com/support.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

zero size buf in output(Bug?)

Priority1 October 09, 2012 10:52AM

Re: zero size buf in output(Bug?)

Maxim Dounin October 09, 2012 03:38PM

Re: zero size buf in output(Bug?)

Priority1 October 09, 2012 06:08PM

Re: zero size buf in output(Bug?)

Maxim Dounin October 10, 2012 07:02AM

Re: zero size buf in output(Bug?)

Priority1 October 10, 2012 09:44AM

Re: zero size buf in output(Bug?)

Maxim Dounin October 10, 2012 12:52PM

Re: zero size buf in output(Bug?)

Andre Jaenisch October 10, 2012 02:08PM

Re: zero size buf in output(Bug?)

Maxim Dounin October 10, 2012 02:30PM

Re: zero size buf in output(Bug?)

Priority1 October 10, 2012 02:32PM

Re: zero size buf in output(Bug?)

Priority1 October 10, 2012 03:06PM

Re: zero size buf in output(Bug?)

Maxim Dounin October 10, 2012 05:18PM

Re: zero size buf in output(Bug?)

VBart October 10, 2012 02:30PM

Re: zero size buf in output(Bug?)

milordk August 27, 2013 09:37AM

Re: zero size buf in output(Bug?)

milordk August 27, 2013 09:43AM

Re: zero size buf in output(Bug?)

B.R. August 27, 2013 12:50PM

Re: zero size buf in output(Bug?)

Richard Stanway August 27, 2013 05:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready