mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/timw/3163-gperftools-build'
* origin/topic/timw/3163-gperftools-build:
Define early_shutdown lambda earlier in zeek-setup, avoids build failure with gperftools
(cherry picked from commit 2da6f94ab6
)
This commit is contained in:
parent
ddaa553418
commit
c19069acdb
1 changed files with 14 additions and 12 deletions
|
@ -774,6 +774,20 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
dbl_histogram_metric_type = make_intrusive<OpaqueType>("dbl_histogram_metric");
|
dbl_histogram_metric_type = make_intrusive<OpaqueType>("dbl_histogram_metric");
|
||||||
dbl_histogram_metric_family_type = make_intrusive<OpaqueType>("dbl_histogram_metric_family");
|
dbl_histogram_metric_family_type = make_intrusive<OpaqueType>("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
|
// The leak-checker tends to produce some false
|
||||||
// positives (memory which had already been
|
// positives (memory which had already been
|
||||||
// allocated before we start the checking is
|
// allocated before we start the checking is
|
||||||
|
@ -867,18 +881,6 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
if ( supervisor_mgr )
|
if ( supervisor_mgr )
|
||||||
supervisor_mgr->InitPostScript();
|
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 )
|
if ( options.print_plugins )
|
||||||
{
|
{
|
||||||
early_shutdown();
|
early_shutdown();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue