mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/awelzel/3190-supervisor-eventmgr-shared-pipe-fix'
* origin/topic/awelzel/3190-supervisor-eventmgr-shared-pipe-fix: event: Reinitialize EventMgr's flare after fork() from stem
This commit is contained in:
commit
22fb445a7f
5 changed files with 33 additions and 1 deletions
15
CHANGES
15
CHANGES
|
@ -1,3 +1,18 @@
|
||||||
|
6.2.0-dev.41 | 2023-10-24 19:35:20 +0200
|
||||||
|
|
||||||
|
* GH-3190: event: Reinitialize EventMgr's flare after fork() from stem (Arne Welzel, Corelight)
|
||||||
|
|
||||||
|
Because EventMgr is defined globally as an object (rather than a global
|
||||||
|
pointer to an EventMgr object), its pipe is created even before main()
|
||||||
|
is entered. This further means that in the fork-based supervisor setup,
|
||||||
|
all Zeek processes created from the top-level supervisor process share
|
||||||
|
the same pipe object for the EventMgr. In turn, whenever any of the
|
||||||
|
processes enqueued an event, the flare was fired and ready for reading
|
||||||
|
on all other processes in the cluster, causing much contention and
|
||||||
|
unneeded overhead.
|
||||||
|
|
||||||
|
* btest/Files/mmdb: golang-ci suggested fixes (Arne Welzel, Corelight)
|
||||||
|
|
||||||
6.2.0-dev.38 | 2023-10-24 13:57:03 +0200
|
6.2.0-dev.38 | 2023-10-24 13:57:03 +0200
|
||||||
|
|
||||||
* base/frameworks/spicy: Do not load base/misc/version (Arne Welzel, Corelight)
|
* base/frameworks/spicy: Do not load base/misc/version (Arne Welzel, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
6.2.0-dev.38
|
6.2.0-dev.41
|
||||||
|
|
|
@ -207,4 +207,12 @@ void EventMgr::InitPostScript()
|
||||||
reporter->FatalError("Failed to register event manager FD with iosource_mgr");
|
reporter->FatalError("Failed to register event manager FD with iosource_mgr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventMgr::InitPostFork()
|
||||||
|
{
|
||||||
|
// Re-initialize the flare, closing and re-opening the underlying
|
||||||
|
// pipe FDs. This is needed so that each Zeek process in a supervisor
|
||||||
|
// setup has its own pipe instead of them all sharing a single pipe.
|
||||||
|
queue_flare = zeek::detail::Flare{};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
|
@ -118,6 +118,9 @@ public:
|
||||||
const char* Tag() override { return "EventManager"; }
|
const char* Tag() override { return "EventManager"; }
|
||||||
void InitPostScript();
|
void InitPostScript();
|
||||||
|
|
||||||
|
// Initialization to be done after a fork() happened.
|
||||||
|
void InitPostFork();
|
||||||
|
|
||||||
uint64_t num_events_queued = 0;
|
uint64_t num_events_queued = 0;
|
||||||
uint64_t num_events_dispatched = 0;
|
uint64_t num_events_dispatched = 0;
|
||||||
|
|
||||||
|
|
|
@ -554,8 +554,14 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
auto stem = Supervisor::CreateStem(options.supervisor_mode);
|
auto stem = Supervisor::CreateStem(options.supervisor_mode);
|
||||||
|
|
||||||
if ( Supervisor::ThisNode() )
|
if ( Supervisor::ThisNode() )
|
||||||
|
{
|
||||||
|
// If we get here, we're a supervised node that just returned
|
||||||
|
// from CreateStem() after being forked from the stem.
|
||||||
Supervisor::ThisNode()->Init(&options);
|
Supervisor::ThisNode()->Init(&options);
|
||||||
|
|
||||||
|
event_mgr.InitPostFork();
|
||||||
|
}
|
||||||
|
|
||||||
script_coverage_mgr.ReadStats();
|
script_coverage_mgr.ReadStats();
|
||||||
|
|
||||||
auto dns_type = options.dns_mode;
|
auto dns_type = options.dns_mode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue