From: Julien Moutinho <julm+public-inbox@sourcephile.fr>
To: Eric Wong <e@80x24.org>
Cc: Dominique Martinet <asmadeus@codewreck.org>, meta@public-inbox.org
Subject: Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
Date: Sun, 20 Feb 2022 02:38:53 +0100 [thread overview]
Message-ID: <20220220013853.4vtvnyvpaichgpkm@sourcephile.fr> (raw)
In-Reply-To: <20220217210233.GA31923@dcvr>
[-- Attachment #1: Type: text/plain, Size: 3484 bytes --]
Hi Eric,
Thank you for following up on this
despite your having more important matters on your shoulders :\
Le jeu. 17 févr. 2022 21h02 +0000, Eric Wong a écrit :
> > Looks like it is waiting on sysread() in
> > https://public-inbox.org/public-inbox.git/tree/t/lei-sigpipe.t#n35
>
> OK, that makes more sense...
My tracing with print statements shows that sysread is passed
and that it is $tp->join which hangs:
[nixbld@localhost:/build]$ cat stderr.log
> lei-sigpipe: begin
> lei-sigpipe: start_script: done
> lei-sigpipe: close w: done
> lei-sigpipe: sysread
> lei-sigpipe: sysread: done
> lei-sigpipe: close r: done
[nixbld@localhost:/build]$ cat start_script.log
> start_script: begin
> start_script: fork
> start_script: pid!=0
> start_script: pid==0
> start_script: pid!=0: tail
> start_script: pid==0: if sub
> start_script: pid==0: exec lei
ps auxwwf | grep nixbld
> nixbld1 491489 0.1 0.0 5312 4036 ? Ss 02:12 0:01 \_ bash -e /nix/store/qf3mzpvsmkrw963xchbivcci06078n13-builder.sh
> nixbld1 494307 0.0 0.1 16672 12616 ? S 02:12 0:00 \_ perl -MExtUtils::Command::MM -MTest::Harness -e undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch') t/lei-sigpipe.t
> nixbld1 494311 0.2 0.5 49320 40068 ? S 02:12 0:02 | \_ t/lei-sigpipe.t
> nixbld1 494445 0.0 0.0 0 0 ? Z 02:12 0:00 | \_ [/nix/store/176g] <defunct>
> nixbld1 494447 0.0 0.1 14388 10176 ? S 02:12 0:00 | \_ /nix/store/6wcdxh3h5jp9qgrccq3n71wnalca5mf5-perl-5.34.0/bin/perl -w -I/nix/store/6wcdxh3h5jp9qgrccq3n71wnalca5mf5-perl-5.34.0/lib/perl5/site_perl -I/nix/store/jibsc747pfzmyxp5lsqgzyvrs2lnkws6-perl5.34.0-Mail-IMAPClient-3.42/lib/perl5/site_perl -I/nix/st blib/script/lei q -q -t z:1..
> nixbld1 494427 0.1 0.5 50664 41892 ? S 02:12 0:00 \_ lei-daemon /build/pi-lei-sigpipe-2750-0bv8/lei-daemon/xdg_run/lei/5.seq.sock
> nixbld1 494433 0.0 0.4 50260 39580 ? S 02:12 0:00 \_ lei/store /build/pi-lei-sigpipe-2750-0bv8/lei-daemon/.local/share
The defunct process with truncated path "/nix/store/176g"
is points to /nix/store/176gh50y24c0lx2bnnmsvf9wazb73php-coreutils-9.0
It appears only when I export TAIL=${coreutils}/bin/tail
which does not workaround the hang.
This deadlock appears only when the test is run by nix,
it doesn't when I run it manually from a terminal
by entering the sandbox:
[nixbld@localhost:/]$ (cd /build/public-inbox-1.7.0; export PERL_INLINE_DIRECTORY=$PWD/inline-c; rm -rf $PERL_INLINE_DIRECTORY; mkdir $PERL_INLINE_DIRECTORY; prove -bvw t/lei-sigpipe.t )
> t/lei-sigpipe.t ..
> ok 1 - lei import $TMPDIR/big.eml
> ok 2 - read one byte
> ok 3 - signaled
> ok 4 - got SIGPIPE
> ok 5 - read one byte
> ok 6 - signaled -f mboxcl2
> ok 7 - got SIGPIPE -f mboxcl2
> ok 8 - read one byte
> ok 9 - signaled -f text
> ok 10 - got SIGPIPE -f text
> ok 11 - lei daemon-pid (daemon-pid after t/lei-sigpipe.t:58)
> ok 12 - daemon running after t/lei-sigpipe.t:58
> ok 13 - lei daemon-kill (daemon-kill after t/lei-sigpipe.t:58)
> ok 14 - t/lei-sigpipe.t:58 daemon stopped
> ok 15 - t/lei-sigpipe.t:58 daemon XDG_RUNTIME_DIR/lei/errors.log empty
> 1..15
> ok
> All tests successful.
> Files=1, Tests=15, 8 wallclock secs ( 0.06 usr 0.08 sys + 3.55 cusr 2.81 csys = 6.50 CPU)
> Result: PASS
[-- Attachment #2: 0001-trace-t-lei-sigpipe.t.patch --]
[-- Type: text/plain, Size: 3841 bytes --]
From d919b3441bdf61e8dfae0c08005b8a77662ddb91 Mon Sep 17 00:00:00 2001
From: Julien Moutinho <julm+public-inbox@sourcephile.fr>
Date: Sun, 20 Feb 2022 01:33:04 +0100
Subject: [PATCH] trace t/lei-sigpipe.t
---
lib/PublicInbox/TestCommon.pm | 10 ++++++++++
t/lei-sigpipe.t | 22 +++++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index ca732811..d8416f90 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -439,6 +439,9 @@ sub start_script {
my $run_mode = $ENV{TEST_RUN_MODE} // $opt->{run_mode} // 2;
my $sub = $run_mode == 0 ? undef : key2sub($key);
my $tail;
+ open my $errfh, '+>>', "/build/start_script.log" or xbail $!;
+ $errfh->autoflush(1);
+ print $errfh "\nstart_script: begin\n";
if ($tail_cmd) {
my @paths;
for (@argv) {
@@ -459,8 +462,10 @@ sub start_script {
}
$tail = tail_f(@paths);
}
+ print $errfh "\nstart_script: fork\n";
my $pid = fork // die "fork: $!\n";
if ($pid == 0) {
+ print $errfh "\nstart_script: pid==0\n";
eval { PublicInbox::DS->Reset };
# pretend to be systemd (cf. sd_listen_fds(3))
# 3 == SD_LISTEN_FDS_START
@@ -484,18 +489,23 @@ sub start_script {
}
if ($opt->{-C}) { chdir($opt->{-C}) or die "chdir: $!" }
$0 = join(' ', @$cmd);
+ print $errfh "\nstart_script: pid==0: if sub\n";
if ($sub) {
+ print $errfh "\nstart_script: pid==0: sub\n";
eval { PublicInbox::DS->Reset };
_run_sub($sub, $key, \@argv);
POSIX::_exit($? >> 8);
} else {
+ print $errfh "\nstart_script: pid==0: exec $key\n";
exec(key2script($key), @argv);
die "FAIL: ",join(' ', $key, @argv), ": $!\n";
}
}
+ print $errfh "\nstart_script: pid!=0\n";
require PublicInbox::AutoReap;
my $td = PublicInbox::AutoReap->new($pid);
$td->{-extra} = $tail;
+ print $errfh "\nstart_script: pid!=0: tail\n";
$td;
}
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index 6b2772a6..e5e701dd 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -6,7 +6,7 @@ use v5.10.1;
use PublicInbox::TestCommon;
use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
test_lei(sub {
- my $f = "$ENV{HOME}/big.eml";
+ my $f = "/build/big.eml";
my $imported;
for my $out ([], [qw(-f mboxcl2)], [qw(-f text)]) {
pipe(my ($r, $w)) or BAIL_OUT $!;
@@ -27,25 +27,33 @@ EOM
}
lei_ok(qw(import), $f) if $imported++ == 0;
- open my $errfh, '+>>', "$ENV{HOME}/stderr.log" or xbail $!;
+ open my $errfh, '+>>', "/build/stderr.log" or xbail $!;
+ $errfh->autoflush(1);
+ print $errfh "\nlei-sigpipe: begin\n";
my $opt = { run_mode => 0, 2 => $errfh, 1 => $w };
my $cmd = [qw(lei q -q -t), @$out, 'z:1..'];
my $tp = start_script($cmd, undef, $opt);
+ print $errfh "\nlei-sigpipe: start_script: done\n";
close $w;
+ print $errfh "\nlei-sigpipe: close w: done\n";
vec(my $rvec = '', fileno($r), 1) = 1;
- if (!select($rvec, undef, undef, 30)) {
+ if (!select($rvec, undef, undef, 3)) {
seek($errfh, 0, 0) or xbail $!;
my $s = do { local $/; <$errfh> };
- xbail "lei q had no output after 30s, stderr=$s";
+ xbail "lei q had no output after 3s, stderr=$s";
}
+ print $errfh "\nlei-sigpipe: sysread\n";
is(sysread($r, my $buf, 1), 1, 'read one byte');
+ print $errfh "\nlei-sigpipe: sysread: done\n";
close $r; # trigger SIGPIPE
+ print $errfh "\nlei-sigpipe: close r: done\n";
$tp->join;
+ print $errfh "\nlei-sigpipe: join: done\n";
ok(WIFSIGNALED($?), "signaled @$out");
is(WTERMSIG($?), SIGPIPE, "got SIGPIPE @$out");
- seek($errfh, 0, 0) or xbail $!;
- my $s = do { local $/; <$errfh> };
- is($s, '', "quiet after sigpipe @$out");
+ #seek($errfh, 0, 0) or xbail $!;
+ #my $s = do { local $/; <$errfh> };
+ #is($s, '', "quiet after sigpipe @$out");
}
});
--
2.34.1
next prev parent reply other threads:[~2022-02-20 1:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 1:07 Test failures with 1.7.0 Julien Moutinho
2021-12-08 4:08 ` Eric Wong
2021-12-08 10:56 ` Dominique Martinet
2021-12-08 18:22 ` [PATCH] nodatacow: quiet chattr errors [was: Test failures with 1.7.0] Eric Wong
2021-12-08 21:14 ` Dominique Martinet
2021-12-08 22:01 ` Dominique Martinet
2022-01-30 21:49 ` Eric Wong
2022-01-30 23:18 ` Dominique Martinet
2022-01-31 2:03 ` Eric Wong
2022-01-31 3:34 ` Dominique Martinet
2022-02-01 1:27 ` Eric Wong
2021-12-09 1:37 ` Test failures with 1.7.0 Julien Moutinho
2021-12-09 2:53 ` Dominique Martinet
2022-02-01 9:37 ` Eric Wong
2022-02-01 23:27 ` FD_CLOEXEC w/ nix-shell [was: Test failures with 1.7.0] Eric Wong
2022-02-02 0:23 ` Dominique Martinet
2022-02-02 2:11 ` Dominique Martinet
2022-02-01 23:34 ` [PATCH] test_lei: use consistent locale for error messages Eric Wong
2022-02-17 21:02 ` [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test Eric Wong
2022-02-20 1:38 ` Julien Moutinho [this message]
2022-02-22 6:44 ` Eric Wong
2022-02-27 4:15 ` Julien Moutinho
2022-02-27 6:41 ` Julien Moutinho
2022-02-27 7:23 ` Dominique Martinet
2022-02-27 8:04 ` Julien Moutinho
2022-02-27 11:17 ` [PATCH] t/lei-sigpipe: ensure SIGPIPE is unblocked for this test Eric Wong
2022-03-11 10:42 ` [PATCH] t/lei-sigpipe.t: ensure SIGPIPE is not ignored instead of not blocked Julien Moutinho
2022-03-14 22:14 ` Eric Wong
2022-03-15 2:56 ` Julien Moutinho
2022-03-01 2:30 ` Test failures with 1.7.0 Julien Moutinho
2022-03-01 4:05 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220220013853.4vtvnyvpaichgpkm@sourcephile.fr \
--to=julm+public-inbox@sourcephile.fr \
--cc=asmadeus@codewreck.org \
--cc=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).