Use a timer to check for death of supervised node's parent

This commit is contained in:
Jon Siwek 2020-01-15 15:27:53 -08:00
parent 7ddd311583
commit dbca14e1fc
6 changed files with 43 additions and 11 deletions

View file

@ -290,17 +290,6 @@ void net_run()
while ( iosource_mgr->Size() ||
(BifConst::exit_only_after_terminate && ! terminating) )
{
// Note: only simple + portable way of detecting loss of parent
// process seems to be polling for change in PPID. There's platform
// specific ways if we do end up needing something more responsive
// and/or have to avoid overhead of polling, but maybe not worth
// the additional complexity:
// Linux: prctl(PR_SET_PDEATHSIG, ...)
// FreeBSD: procctl(PROC_PDEATHSIG_CTL)
// TODO: make this a proper timer
if ( zeek::supervised_node && zeek::supervised_node->parent_pid != getppid() )
zeek_terminate_loop("supervised cluster node was orphaned");
double ts;
iosource::IOSource* src = iosource_mgr->FindSoonest(&ts);