On Fri, 22 May 2009, Charlie Brady wrote:
On Fri, 22 May 2009, J wrote:
However, I'm back to seeing the connection processes being left behind,
despite an explicit quit from the remote host. I suspect this is due to
not using a queueing plugin, at this point.
I also see that 'svc -d' leaves all the qpsmtpd-prefork processes in the
rocess table. Do I need to write something to down the service as well as
remove the processes?
No, the parent process should handle the TERM signal, should propagate it to
any children, wait for them to die, and should then exit. If it's not doing
that, it needs to be fixed.
Here's what I see when I run prefork under strace, and hit the parent
process with SIGTERM:
[pid 5080] nanosleep({30, 0}, 0xbfeb7544) = ? ERESTART_RESTARTBLOCK (To be
restarted)
[pid 5080] --- SIGTERM (Terminated) @ 0 (0) ---
[pid 5080] sigreturn() = ? (mask now [])
[pid 5080] time(NULL) = 1232904040
[pid 5080] rt_sigprocmask(SIG_BLOCK, [TERM], NULL, 8) = 0
[pid 5080] rt_sigprocmask(SIG_BLOCK, [HUP], [TERM], 8) = 0
[pid 5080] rt_sigaction(SIGHUP, {SIG_IGN}, {0x5516d7, [], SA_RESTORER,
0x43b9c8}, 8) = 0
[pid 5080] rt_sigprocmask(SIG_SETMASK, [TERM], NULL, 8) = 0
[pid 5080] rt_sigprocmask(SIG_BLOCK, [CHLD], [TERM], 8) = 0
[pid 5080] rt_sigaction(SIGCHLD, {SIG_IGN}, {0x5516d7, [], SA_RESTORER,
0x43b9c8}, 8) = 0
[pid 5080] rt_sigprocmask(SIG_SETMASK, [TERM], NULL, 8) = 0
[pid 5080] rt_sigprocmask(SIG_BLOCK, [TERM], [TERM], 8) = 0
[pid 5080] rt_sigaction(SIGTERM, {SIG_IGN}, {0x5516d7, [], SA_RESTORER,
0x43b9c8}, 8) = 0
[pid 5080] rt_sigprocmask(SIG_SETMASK, [TERM], NULL, 8) = 0
[pid 5080] close(3) = 0
[pid 5080] close(4) = 0
[pid 5080] kill(-5080, SIGTERM) = -1 ESRCH (No such process)
[pid 5080] exit_group(0) = ?
Process 5080 detached
It looks to me as though qpsmtpd should have started a new process group
with the parent process, but hasn't. Or the developer assumed that qpsmtpd
would be set up as leader of a process group, but it isn't in this
circumstance.
Try this as your run file:
#!/bin/sh
exec 2>&1
exec \
/usr/local/bin/softlimit -m 1000000000 \
/usr/local/bin/pgrphack \
/usr/bin/perl -T ./qpsmtpd-prefork \
--listen-address 0.0.0.0:25 \
--listen-address 0.0.0.0:587 \
--children 30 \
--idle-children 5 \
--max-from-ip 2 \
--user smtpd