From 9da6fcbb3e6d720a4b575a48063ecf3240a44022 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 30 Apr 2016 02:57:40 +0000 Subject: daemon: graceful shutdown warning and limit removal git clones may take longer than 30s, much longer... So prepare to wait almost indefinitely for sockets to timeout and document the second signal behavior for immediate shutdown. While we're at it, move parent death handling to a separate class to avoid Danga::Socket->AddOtherFds, since that does not allow proper handling the parent pipe being closed and would actually misterminate a worker prematurely. t/nntpd.t is update to illustrate the failure with workers enabled. We will work to keep memory usage low and let clients take their time without interrupting them. --- t/nntpd.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/nntpd.t b/t/nntpd.t index d597855b..d0332216 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -185,7 +185,12 @@ EOF 'XHDR on invalid header returns empty'); { - syswrite($s, "HDR List-id 1-\r\n"); + setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1); + syswrite($s, 'HDR List-id 1-'); + select(undef, undef, undef, 0.15); + ok(kill('TERM', $pid), 'killed nntpd'); + select(undef, undef, undef, 0.15); + syswrite($s, "\r\n"); $buf = ''; do { sysread($s, $buf, 4096, length($buf)); @@ -196,9 +201,8 @@ EOF is(scalar @r, 1, 'only one response line'); } - ok(kill('TERM', $pid), 'killed nntpd'); - $pid = undef; - waitpid(-1, 0); + is($pid, waitpid($pid, 0), 'nntpd exited successfully'); + is($?, 0, 'no error in exited process'); } done_testing(); -- cgit v1.2.3-24-ge0c7