zero size buf in output(Bug?)
Maxim Dounin
mdounin at mdounin.ru
Tue Oct 9 19:36:54 UTC 2012
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
More information about the nginx
mailing list