From 53d106235ba9e4d464f30d27d2bcc997e3db9948 Mon Sep 17 00:00:00 2001 From: Alexander Drozdov Date: Thu, 10 Mar 2022 17:40:40 +0300 Subject: [PATCH] fix infinite loop on connection failures ngx_http_upsync_connect_handler(): When ngx_event_connect_peer() fails, we shouldn't set the current timer timeout to 0 as that immediatelly calls the current function again. Instead, we should call ngx_http_upsync_clean_event() to properly clean up & to set the reconnection timer. --- src/ngx_http_upsync_module.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ngx_http_upsync_module.c b/src/ngx_http_upsync_module.c index 1d3cc6f..749d6ea 100644 --- a/src/ngx_http_upsync_module.c +++ b/src/ngx_http_upsync_module.c @@ -2643,9 +2643,7 @@ ngx_http_upsync_connect_handler(ngx_event_t *event) "upsync_connect_handler: cannot connect to upsync_server: %V ", upsync_server->pc.name); - ngx_del_timer(&upsync_server->upsync_timeout_ev); - ngx_add_timer(&upsync_server->upsync_ev, 0); - + ngx_http_upsync_clean_event(upsync_server); return; }