procServ icon indicating copy to clipboard operation
procServ copied to clipboard

child process cannot be terminated with SIGTERM

Open dirk-zimoch opened this issue 3 years ago • 5 comments

Since V6.6.1, to be exact since commit 291c7a08b342e6df134d40bd996543fd41fd1a5f "Make signal handling safe using pselect.", the child process started by procServ cannot be terminated with SIGTERM any longer. In particular --killsig 15 does not work.

The reason is probably that the child inherits the signal mask which blocks SIGTERM (and SIGPIPE and SIGHUP).

Signal mask should be reset to "normal" for the child.

dirk-zimoch avatar Apr 15 '21 12:04 dirk-zimoch

+1

ralphlange avatar Apr 15 '21 12:04 ralphlange

man sigprocmask:

A child created via fork(2) inherits a copy of its parent's signal mask; the signal mask is preserved across execve(2).

dirk-zimoch avatar Apr 15 '21 13:04 dirk-zimoch

Argh, only half the job... Need to handle SIG_IGN as well.

dirk-zimoch avatar Apr 15 '21 14:04 dirk-zimoch

I replaced ignoring signals by blocking signals so that signals can be restored easier in the child process.

dirk-zimoch avatar Apr 15 '21 16:04 dirk-zimoch

Should I put the fix for the annoying SigPipe message #43 into this branch, too?

I would also like to clean up spaces and tabs.

dirk-zimoch avatar Apr 15 '21 16:04 dirk-zimoch