[PATCH 1 of 3] Upstream: clearing of u->peer.connection on close

Maxim Dounin mdounin at mdounin.ru
Sun Sep 25 10:42:04 UTC 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1316882053 -14400
# Node ID f1cbffaa09dcc5e8d9f3fc888abcac8e6e7c38b3
# Parent  6c19b251b92674710573c472e8aba406fa72da50
Upstream: clearing of u->peer.connection on close.

This fixes crashes observed with some 3rd party balancer modules.  Standard
balancer modules (round-robin and ip hash) explicitly set pc->connection
(aka u->peer.connection) to NULL and aren't affected.

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
@@ -2927,6 +2927,7 @@ ngx_http_upstream_next(ngx_http_request_
         }
 
         ngx_close_connection(u->peer.connection);
+        u->peer.connection = NULL;
     }
 
 #if 0



More information about the nginx-devel mailing list