]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 29 Jun 2021 05:28:02 +0000 (17:28 +1200)
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 9706f7e0d6b7ba38cc1613f3ad191b33964abe68..15f4f54aba85a257476f05ff3d8f011bd6567367 100644 (file)
@@ -967,8 +967,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);
     }
 }