]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Reconfiguration orphans stateless helper connection (#842)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 11 Jun 2021 22:26:31 +0000 (22:26 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 16 Jun 2021 04:42:07 +0000 (04:42 +0000)
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

index 18460f0d37eec7b04478d829c7929e624f292b2e..e01749b3049a120be2ca4b2c7650ba6deca1f800 100644 (file)
@@ -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);
     }
 }