diff --git a/CHANGES b/CHANGES index bcf35f0df6..b60e749889 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +6.1.0-dev.175 | 2023-07-06 09:27:03 +0200 + + * Define early_shutdown lambda earlier in zeek-setup, avoids build failure with gperftools (Tim Wojtulewicz) + 6.1.0-dev.172 | 2023-07-05 13:32:42 -0700 * Set `SPICY_BUILD_DIRECTORY` in `zeek-path-dev`. (Robin Sommer, Corelight) diff --git a/VERSION b/VERSION index b39b0875af..ab25c7fa58 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.0-dev.172 +6.1.0-dev.175 diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index 46d5eacef0..8258329f5a 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -774,6 +774,20 @@ SetupResult setup(int argc, char** argv, Options* zopts) dbl_histogram_metric_type = make_intrusive("dbl_histogram_metric"); dbl_histogram_metric_family_type = make_intrusive("dbl_histogram_metric_family"); + // After spinning up Broker, we have background threads running now. If + // we exit early, we need to shut down at least Broker to get a clean + // program exit. Otherwise, we may run into undefined behavior, e.g., if + // Broker is still accessing OpenSSL but OpenSSL has already cleaned up + // its state due to calling exit(). This needs to be defined here before + // potential USE_PERFTOOLS_DEBUG scope below or the definition gets lost + // when that variable is defined. + auto early_shutdown = [] + { + broker_mgr->Terminate(); + delete iosource_mgr; + delete telemetry_mgr; + }; + // The leak-checker tends to produce some false // positives (memory which had already been // allocated before we start the checking is @@ -867,18 +881,6 @@ SetupResult setup(int argc, char** argv, Options* zopts) if ( supervisor_mgr ) supervisor_mgr->InitPostScript(); - // After spinning up Broker, we have background threads running now. If - // we exit early, we need to shut down at least Broker to get a clean - // program exit. Otherwise, we may run into undefined behavior, e.g., if - // Broker is still accessing OpenSSL but OpenSSL has already cleaned up - // its state due to calling exit(). - auto early_shutdown = [] - { - broker_mgr->Terminate(); - delete iosource_mgr; - delete telemetry_mgr; - }; - if ( options.print_plugins ) { early_shutdown();