From: Stephan Bosch Date: Thu, 6 Sep 2018 01:11:18 +0000 (+0200) Subject: lib-http: client: peer: Always run http_client_queue_connection_failure() upon defini... X-Git-Tag: 2.3.4~221 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb60be8b6942b4717b451f1d529edd3d2a43aad2;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: peer: Always run http_client_queue_connection_failure() upon definitive connection failure. The recorded peer->connecting flag was highly unreliable in a scenario involving starting parallel connections. This way, the linked queues can update their state accordingly. Also, this will not cause empty queues to initiate new connection, because empty queues will do nothing after updating the connection state. This problem caused a client ioloop hang in high-load conditions. --- diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index f652598843..a2ce1f5d7b 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -785,8 +785,6 @@ http_client_peer_connect_backoff(struct http_client_peer *peer) static void http_client_peer_connect(struct http_client_peer *peer, unsigned int count) { - peer->connecting = TRUE; - if (http_client_peer_shared_start_backoff_timer(peer->shared)) { peer->connect_backoff = TRUE; return; @@ -818,8 +816,6 @@ http_client_peer_cancel(struct http_client_peer *peer) e_debug(peer->event, "Peer cancel"); - peer->connecting = FALSE; - /* make a copy of the connection array; freed connections modify it */ t_array_init(&conns, array_count(&peer->conns)); array_copy(&conns.arr, 0, &peer->conns.arr, 0, array_count(&peer->conns)); @@ -1191,8 +1187,6 @@ void http_client_peer_connection_success(struct http_client_peer *peer) struct http_client_peer_pool *ppool = peer->ppool; struct http_client_queue *const *queue; - peer->connecting = FALSE; - http_client_peer_pool_connection_success(ppool); e_debug(peer->event, "Successfully connected (connections=%u)", @@ -1218,10 +1212,6 @@ http_client_peer_connection_failed_any(struct http_client_peer *peer, { struct http_client_queue *const *queue; - if (!peer->connecting) - return; - peer->connecting = FALSE; - e_debug(peer->event, "Connection failed: %s", reason); /* failed to make any connection. a second connect will probably also diff --git a/src/lib-http/http-client-private.h b/src/lib-http/http-client-private.h index 85e7a4d574..eee47cb9fe 100644 --- a/src/lib-http/http-client-private.h +++ b/src/lib-http/http-client-private.h @@ -278,7 +278,6 @@ struct http_client_peer { /* zero time-out for consolidating request handling */ struct timeout *to_req_handling; - bool connecting:1; /* peer is waiting to be connected */ bool connect_backoff:1; /* peer is waiting for backoff timout*/ bool disconnected:1; /* peer is already disconnected */ bool handling_requests:1;/* currently running request handler */