event: Reinitialize EventMgr's flare after fork() from stem

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.

Closes #3190
This commit is contained in:
Arne Welzel 2023-10-20 16:36:13 +02:00
parent 16a51218a5
commit d8a0822221
3 changed files with 17 additions and 0 deletions

View file

@ -118,6 +118,9 @@ public:
const char* Tag() override { return "EventManager"; }
void InitPostScript();
// Initialization to be done after a fork() happened.
void InitPostFork();
uint64_t num_events_queued = 0;
uint64_t num_events_dispatched = 0;