From 553d498cfe1eb1eb3a03280a0e8bb9b566171887 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 20 Apr 2014 22:13:31 -0700 Subject: [PATCH] Trigger finishShutdown runners event before pooled memory is released This allows runner destructors to operate their cleanup even if the component memory they are cleaning up is pooled. --- src/base/RunnersRegistry.h | 2 +- src/main.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/RunnersRegistry.h b/src/base/RunnersRegistry.h index d0e369c208..8a401651cf 100644 --- a/src/base/RunnersRegistry.h +++ b/src/base/RunnersRegistry.h @@ -60,7 +60,7 @@ public: /// Meant for cleanup and state saving that may require other modules. virtual void startShutdown() {} - /// Called after stopping the main loop. + /// Called after stopping the main loop and before releasing memory. /// Meant for quick/basic cleanup that does not require any other modules. virtual ~RegisteredRunner() {} /// exists to simplify caller interface; override the destructor instead diff --git a/src/main.cc b/src/main.cc index 59d24b8a62..09d0616b6c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1907,10 +1907,10 @@ SquidShutdown() comm_exit(); - memClean(); - RunRegisteredHere(RegisteredRunner::finishShutdown); + memClean(); + if (IamPrimaryProcess()) { if (Config.pidFilename && strcmp(Config.pidFilename, "none") != 0) { enter_suid(); -- 2.47.2