Hi,

In fork mode, sending a sigterm signal to a child is caught by the parent. I suspect it has something to do with signal_pipe being shared by the child and parent after the fork.

Here I sent a signal to the parent while a child process was also running. The parent shut down as expected. After sending sigterm, the child remains.

Processes before sigterm: 

UID        PID  PPID  C STIME TTY      STAT   TIME CMD
user      1423     1  0 10:32 ?        Ss     0:00 /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf
user      1921  1423  0 10:37 ?        S      0:00  \_ /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf

selected pid 1423

Processes after:

UID        PID  PPID  C STIME TTY      STAT   TIME CMD
user      1921     1  0 10:37 ?        S      0:00 /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf

Here I sent the signal to the child. The parent shut down and the child completed normally.

Processes before:

UID        PID  PPID  C STIME TTY      STAT   TIME CMD
user      1276     1  0 10:31 ?        Ss     0:00 /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf
user      1309  1276  0 10:31 ?        S      0:00  \_ /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf

selected pid 1309

Processes after:

UID        PID  PPID  C STIME TTY      STAT   TIME CMD
user      1309     1  0 10:31 ?        S      0:00 /usr/local/stunnel/bin/stunnel.bin /usr/local/stunnel/etc/server.conf

I know I should be trying threads. I will eventually. I can only switch once I validate it can sustain our level of traffic. Fork has done that flawlessly for many years now. 

Best regards,


--
Philippe Anctil