* [PATCH 1/4] testcommon: DESTROY: wait for killed daemon
2020-04-11 10:53 5% [PATCH 0/4] FreeBSD and test fixes Eric Wong
@ 2020-04-11 10:53 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-04-11 10:53 UTC (permalink / raw)
To: meta
Otherwise, the waitpid(-1, 0) call in Xapcmd::process_queue()
may reap it in a subsequent test when using t/run.perl to reuse
processes for testing.
While we're at it, make Xapcmd::process_queue warn about unknown
PIDs in case other PIDs leak through to us in the future.
---
lib/PublicInbox/TestCommon.pm | 6 +++---
lib/PublicInbox/Xapcmd.pm | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 6e3e9d8c..e9efbac7 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -319,8 +319,9 @@ sub kill {
}
sub join {
- my ($self) = @_;
+ my ($self, $sig) = @_;
my $pid = delete $self->{pid} or return;
+ CORE::kill($sig, $pid) if defined $sig;
my $ret = waitpid($pid, 0);
defined($ret) or die "waitpid($pid): $!";
$ret == $pid or die "waitpid($pid) != $ret";
@@ -333,8 +334,7 @@ sub DESTROY {
PublicInbox::TestCommon::wait_for_tail();
CORE::kill('TERM', $tail);
}
- my $pid = delete $self->{pid} or return;
- CORE::kill('TERM', $pid);
+ $self->join('TERM');
}
1;
diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm
index 8e2b9063..337978bd 100644
--- a/lib/PublicInbox/Xapcmd.pm
+++ b/lib/PublicInbox/Xapcmd.pm
@@ -142,7 +142,11 @@ sub process_queue {
while (scalar keys %pids) {
my $pid = waitpid(-1, 0);
my $args = delete $pids{$pid};
- die join(' ', @$args)." failed: $?\n" if $?;
+ if ($args) {
+ die join(' ', @$args)." failed: $?\n" if $?;
+ } else {
+ warn "unknown PID($pid) reaped: $?\n";
+ }
}
}
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] FreeBSD and test fixes
@ 2020-04-11 10:53 5% Eric Wong
2020-04-11 10:53 7% ` [PATCH 1/4] testcommon: DESTROY: wait for killed daemon Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-04-11 10:53 UTC (permalink / raw)
To: meta
Looping the tests for hours on end with a FreeBSD 11.2 VM
revealed some problems (and a minor cleanup) I didn't
find on my Debian GNU/Linux systems.
Eric Wong (4):
testcommon: DESTROY: wait for killed daemon
dskqxs: ignore EV_SET errors on EVFILT_WRITE
t/*.t: localize $SIG{__WARN__} changes
t/httpd-corner.t: relax read-after-failed-write handling
lib/PublicInbox/DSKQXS.pm | 4 ++--
lib/PublicInbox/TestCommon.pm | 6 +++---
lib/PublicInbox/Xapcmd.pm | 6 +++++-
t/httpd-corner.t | 39 +++++++++++++++++++++--------------
t/mda_filter_rubylang.t | 2 +-
t/nntpd.t | 2 +-
t/watch_filter_rubylang.t | 2 +-
7 files changed, 36 insertions(+), 25 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-04-11 10:53 5% [PATCH 0/4] FreeBSD and test fixes Eric Wong
2020-04-11 10:53 7% ` [PATCH 1/4] testcommon: DESTROY: wait for killed daemon Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).