cep21 / healthcheck_nginx_upstreams

Health checks upstreams for nginx
http://wiki.nginx.org/NginxHttpHealthcheckModule
253 stars 599 forks source link

nginx 1.7.4 reload master crash #20

Closed ton31337 closed 6 years ago

ton31337 commented 10 years ago

Hi,

after performing some reload at once, nginx's master process goes down, but workers are still alive. Got a break on function it crashes and saw, that peer_shm->upstream_name isn't NULL, but peer_shm->upstream->data is '\001' instead of normal data as like upstream_name->data. peer_shm->sockaddr contains a good address, only upstream_name somehow is missed. I dropped the checking for the upstream_name and everything works well.

--- nginx_upstream_check_module-master/ngx_http_upstream_check_module.c 2014-10-31 10:19:55.509286000 -0400
+++ nginx_upstream_check_module-master/ngx_http_upstream_check_module.c 2014-10-31 10:37:51.741286000 -0400
@@ -3991,10 +3991,8 @@ ngx_http_upstream_check_find_shm_peer(ng
             continue;
         }

-        if ((ngx_memcmp(addr->sockaddr, peer_shm->sockaddr, addr->socklen) == 0)
-            && (ngx_strncmp(upstream_name->data, peer_shm->upstream_name->data,
-                            upstream_name->len) == 0)) {
-            return peer_shm;
+        if(ngx_memcmp(addr->sockaddr, peer_shm->sockaddr, addr->socklen) == 0) {
+          return peer_shm;
         }
     }