From 1f21a0a394a2d8a41201a20ea6869530e94c379d Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 3 May 2023 16:37:36 +0200 Subject: [PATCH] dnsdist: check that the UDP responder thread is running after reconnecting (cherry picked from commit bb1ace1fedca0f6bdd2a962514cd5a6491f3c703) --- pdns/dnsdistdist/dnsdist-backend.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/dnsdist-backend.cc b/pdns/dnsdistdist/dnsdist-backend.cc index 40e7033ac9..97cd0e46ec 100644 --- a/pdns/dnsdistdist/dnsdist-backend.cc +++ b/pdns/dnsdistdist/dnsdist-backend.cc @@ -120,6 +120,12 @@ bool DownstreamState::reconnect(bool initialAttempt) if (connected) { tl.unlock(); d_connectedWait.notify_all(); + if (!initialAttempt) { + /* we need to be careful not to start this + thread too soon, as the creation should only + happen after the configuration has been parsed */ + start(); + } } return connected; @@ -774,7 +780,6 @@ void DownstreamState::submitHealthCheckResult(bool initial, bool newResult) if (newState && !isTCPOnly() && (!connected || d_config.reconnectOnUp)) { newState = reconnect(); - start(); } setUpStatus(newState); -- 2.47.2