Welcome! Log In Create A New Profile

Advanced

Re: zero size buf in output при proxy cache

Maxim Dounin
March 04, 2016 10:58AM
Hello!

On Thu, Feb 25, 2016 at 08:25:23PM +0300, Maxim Dounin wrote:

> On Thu, Feb 25, 2016 at 06:19:04PM +0300, Иван wrote:
>
> > Можем ли мы еще что-то сделать для решения этой проблемы?

[...]

> В почте у меня соответствующее письмо отмечено, но вряд ли я
> доберусь до "посмотреть это подробнее" в ближайшее время.

JFYI, запостил в тикет[1] патч для этой проблемы, благо она тут
случайно воспроизвелась.

[1] https://trac.nginx.org/nginx/ticket/918

# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1457105784 -10800
# Fri Mar 04 18:36:24 2016 +0300
# Node ID 36a4f55e09d6910f79507635b6e5a773e487fa08
# Parent c5f81dcf97a79576138917501c9a6cc6f53ee930
Upstream: fixed "zero size buf" alerts with cache (ticket #918).

If caching was used, "zero size buf in output" alerts might appear
in logs if a client prematurely closed connection. Alerts appeared
in the following situation:

- writing to client returned an error, so event pipe
drained all busy buffers leaving body output filters
in an invalid state;

- when upstream response was fully received,
ngx_http_upstream_finalize_request() tried to flush
all pending data.

Fix is to avoid flushing body if c->error is set.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4068,7 +4068,8 @@ ngx_http_upstream_finalize_request(ngx_h

if (!u->header_sent
|| rc == NGX_HTTP_REQUEST_TIME_OUT
- || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST)
+ || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
+ || r->connection->error)
{
ngx_http_finalize_request(r, rc);
return;

--
Maxim Dounin
http://nginx.org/

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

zero size buf in output при proxy_cache

iprok February 16, 2016 02:00PM

Re: zero size buf in output при proxy cache

Maxim Dounin February 16, 2016 03:06PM

Re: zero size buf in output при proxy cache

iprok February 16, 2016 03:19PM

Re: zero size buf in output при proxy cache

Иван February 25, 2016 10:20AM

Re: zero size buf in output при proxy cache

Maxim Dounin February 25, 2016 12:26PM

Re: zero size buf in output при proxy cache

Maxim Dounin March 04, 2016 10:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
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