I've got an application that starts stunnel using equivalent of a fork/exec. The stunnel process then appears to fork off multiple copies of itself.
Before the application exits, it needs to stop stunnel. I send a SIGINT to the PID that was created using the fork, but only the first "master" copy terminates -- the master stunnel process doesn't terminate its children when it exits. So I end up with a bunch of "orphaned" stunnel processes. They're not zombies, they're process that are either in state R or S (runnable or sleeping).
How do I tell stunnel to not only terminate, but to terminate whatever child processes it has created?
On 2008-06-25, Grant Edwards grante@visi.com wrote:
I've got an application that starts stunnel using equivalent of a fork/exec. The stunnel process then appears to fork off multiple copies of itself.
Before the application exits, it needs to stop stunnel. I send a SIGINT to the PID that was created using the fork, but only the first "master" copy terminates -- the master stunnel process doesn't terminate its children when it exits. So I end up with a bunch of "orphaned" stunnel processes. They're not zombies, they're process that are either in state R or S (runnable or sleeping).
What's really annoying is that one of those orphaned stunnel processes is sucking up all the CPU it can (there are no active connections).
On 2008-06-25, Grant Edwards grante@visi.com wrote:
I've got an application that starts stunnel using equivalent of a fork/exec. The stunnel process then appears to fork off multiple copies of itself.
That actually raises another question: why does it take 6 copies of the stunnel process to handle the forwarding of one TCP port?
On Wed, Jun 25, 2008 at 02:57:39PM +0000, Grant Edwards wrote:
I've got an application that starts stunnel using equivalent of a fork/exec. The stunnel process then appears to fork off multiple copies of itself.
Before the application exits, it needs to stop stunnel. I send a SIGINT to the PID that was created using the fork, but only the first "master" copy terminates -- the master stunnel process doesn't terminate its children when it exits. So I end up with a bunch of "orphaned" stunnel processes. They're not zombies, they're process that are either in state R or S (runnable or sleeping).
How do I tell stunnel to not only terminate, but to terminate whatever child processes it has created?
If you have built stunnel with libwrap support, chances are high that the patch from this message might help you:
http://stunnel.mirt.net/pipermail/stunnel-users/2008-June/002021.html
G'luck, Peter
On 2008-06-25, Peter Pentchev roam@ringlet.net wrote:
On Wed, Jun 25, 2008 at 02:57:39PM +0000, Grant Edwards wrote:
Before the application exits, it needs to stop stunnel. I send a SIGINT to the PID that was created using the fork, but only the first "master" copy terminates -- the master stunnel process doesn't terminate its children when it exits.
[...]
If you have built stunnel with libwrap support, chances are high that the patch from this message might help you:
http://stunnel.mirt.net/pipermail/stunnel-users/2008-June/002021.html
I decided to run stunnel in its own process group. That way I can just send a SIGINT to the whole group when I want stunnel to terminate. So far it seems to be working...