Re: zero size buf in output при proxy cache
Maxim Dounin
mdounin на mdounin.ru
Пт Мар 4 15:57:45 UTC 2016
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 at 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