]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: restore old sigmask before daemon exit
authorEric Wong <e@80x24.org>
Sat, 25 Sep 2021 05:49:44 +0000 (05:49 +0000)
committerEric Wong <e@80x24.org>
Sat, 25 Sep 2021 08:53:44 +0000 (08:53 +0000)
If the event loop fails, we want blocking waitpid (wait4) calls
to be interruptible with SIGTERM via "kill $PID" rather than
SIGKILL.  Though a failing event loop is something we should
avoid...

lib/PublicInbox/LEI.pm

index 9d5a5a46b3987fc05d4095fd31d751f37fa4c462..3ff8a347af8bd30735cdc22a4706f0b4c0f9fe89 100644 (file)
@@ -1346,6 +1346,8 @@ sub lazy_start {
        # $daemon pipe to `lei' closed, main loop begins:
        eval { PublicInbox::DS->EventLoop };
        warn "event loop error: $@\n" if $@;
+       # exit() may trigger waitpid via various DESTROY, ensure interruptible
+       PublicInbox::DS::sig_setmask($oldset);
        dump_and_clear_log();
        exit($exit_code // 0);
 }