From 0efe61fd2ca13c8c7c22c80082377de6261516d6 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Fri, 11 Jun 2021 22:26:31 +0000 Subject: [PATCH] Reconfiguration orphans stateless helper connection (#842) The helper.cc code (ab)uses two different Connection objects with the same FD. Properly fixing that problem requires significant work, but the official code almost gets away with it, in part, because helper.cc, with one exception, uses heavily customized code to "safely" close its connections (instead of just calling conn->close() as many Squid jobs still do). This fix replaces that single exceptional case with a closeWritePipeSafely() call which prevents orphaning readPipe and triggering BUG 3329 warnings. It also restores the symmetry between the corresponding (previously buggy) stateless and (OK) statefull code. A code merge mistake in commit b038892 created this bug AFAICT. --- src/helper.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/helper.cc b/src/helper.cc index 18460f0d37..e01749b304 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -968,8 +968,7 @@ helperReturnBuffer(helper_server * srv, helper * hlp, char * msg, size_t msgSize if (!srv->flags.shutdown) { helperKickQueue(hlp); } else if (!srv->flags.closing && !srv->stats.pending) { - srv->flags.closing=true; - srv->writePipe->close(); + srv->closeWritePipeSafely(srv->parent->id_name); } } -- 2.47.2