user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-27  7:23  8%                 ` Dominique Martinet
@ 2022-02-27  8:04  8%                   ` Julien Moutinho
  0 siblings, 0 replies; 7+ results
From: Julien Moutinho @ 2022-02-27  8:04 UTC (permalink / raw)
  To: Dominique Martinet; +Cc: Eric Wong, meta

Le dim. 27 févr. 2022 16h23 +0900, Dominique Martinet a écrit :
> I guess we can now open a nix issue asking to reset signal handlers
> after fork, before executing its builder?...
Well spotted Dominique, thanks!

Turns out this is actually systemd which ignores SIGPIPE.
I'm able to pass t/lei-sigpipe.t when my `nix build`
connects to a nix-daemon run manually outside systemd.
There is already a 3yo issue on nix's tracker for that:
https://github.com/NixOS/nix/issues/2803
suggesting to add to nix-daemon.service:
> [Service]
> IgnoreSIGPIPE=no
And that indeed also makes t/lei-sigpipe.t succeed.

In the meantime I'll disable t/lei-sigpipe.t
to finally get public-inbox added to Nixpkgs.

Thank you Dominique and Eric!

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-27  6:41  8%               ` Julien Moutinho
@ 2022-02-27  7:23  8%                 ` Dominique Martinet
  2022-02-27  8:04  8%                   ` Julien Moutinho
  0 siblings, 1 reply; 7+ results
From: Dominique Martinet @ 2022-02-27  7:23 UTC (permalink / raw)
  To: Julien Moutinho; +Cc: Eric Wong, meta

Hello,

Julien Moutinho wrote on Sun, Feb 27, 2022 at 07:41:44AM +0100:
> Le dim. 27 févr. 2022 05h15 +0100, Julien Moutinho a écrit :
> > Yes, I'm using:
> > $ nix-daemon --version
> > > nix-daemon (Nix) 2.7.0pre20220127_558c4ee
> Dominique reminded me that that fix was first intended for
> `nix develop`, so I've asked whether it also applies to `nix build`:
> https://github.com/NixOS/nix/pull/5683#issuecomment-1053239025

I've replied over there, I don't think leaked fd is a problem.

However Julien's latest traces gave a good enough hint: the lei process
that should die from sigpipe just didn't die...
And surely enough, nix adds SIGPIPE to ignores.
This can be confirmed by looking at SigIgn in /proc/xxx/status of one of
the builder PIDs:
# grep SigIgn /proc/3124202/status
SigIgn:	0000000000001004

Where 0x1000 is the 13th bit:
$ kill -l 13
PIPE

Running tests manually won't inherit masked signals and thus won't
reproduce.


I guess we can now open a nix issue asking to reset signal handlers
after fork, before executing its builder?...

-- 
Dominique

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-27  4:15  8%             ` Julien Moutinho
@ 2022-02-27  6:41  8%               ` Julien Moutinho
  2022-02-27  7:23  8%                 ` Dominique Martinet
  0 siblings, 1 reply; 7+ results
From: Julien Moutinho @ 2022-02-27  6:41 UTC (permalink / raw)
  To: Eric Wong; +Cc: Dominique Martinet, meta

Le dim. 27 févr. 2022 05h15 +0100, Julien Moutinho a écrit :
> Yes, I'm using:
> $ nix-daemon --version
> > nix-daemon (Nix) 2.7.0pre20220127_558c4ee
Dominique reminded me that that fix was first intended for
`nix develop`, so I've asked whether it also applies to `nix build`:
https://github.com/NixOS/nix/pull/5683#issuecomment-1053239025

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-22  6:44  8%           ` Eric Wong
@ 2022-02-27  4:15  8%             ` Julien Moutinho
  2022-02-27  6:41  8%               ` Julien Moutinho
  0 siblings, 1 reply; 7+ results
From: Julien Moutinho @ 2022-02-27  4:15 UTC (permalink / raw)
  To: Eric Wong; +Cc: Dominique Martinet, meta

Le mar. 22 févr. 2022 06h44 +0000, Eric Wong a écrit :
> Julien Moutinho <julm+public-inbox@sourcephile.fr> wrote:
> > 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:
> 
> Oh, btw, is this with the FD_CLOEXEC fixes to nix shell itself?
> https://public-inbox.org/meta/YfnoOVOG3TrbqZFs@codewreck.org/

Yes, I'm using:
$ nix-daemon --version
> nix-daemon (Nix) 2.7.0pre20220127_558c4ee

Which contains the commit from https://github.com/NixOS/nix/pull/5683 :
$ git merge-base --is-ancestor 6e0cbc666b60515b5e201dd28855f5fe1de9a107 558c4ee
$ echo $?
> 0

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-20  1:38  5%         ` Julien Moutinho
@ 2022-02-22  6:44  8%           ` Eric Wong
  2022-02-27  4:15  8%             ` Julien Moutinho
  0 siblings, 1 reply; 7+ results
From: Eric Wong @ 2022-02-22  6:44 UTC (permalink / raw)
  To: Julien Moutinho; +Cc: Dominique Martinet, meta

Julien Moutinho <julm+public-inbox@sourcephile.fr> wrote:
> 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:

Oh, btw, is this with the FD_CLOEXEC fixes to nix shell itself?
https://public-inbox.org/meta/YfnoOVOG3TrbqZFs@codewreck.org/

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  2022-02-17 21:02 14%       ` [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test Eric Wong
@ 2022-02-20  1:38  5%         ` Julien Moutinho
  2022-02-22  6:44  8%           ` Eric Wong
  0 siblings, 1 reply; 7+ results
From: Julien Moutinho @ 2022-02-20  1:38 UTC (permalink / raw)
  To: Eric Wong; +Cc: Dominique Martinet, meta

[-- 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


^ permalink raw reply related	[relevance 5%]

* [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test
  @ 2022-02-17 21:02 14%       ` Eric Wong
  2022-02-20  1:38  5%         ` Julien Moutinho
  0 siblings, 1 reply; 7+ results
From: Eric Wong @ 2022-02-17 21:02 UTC (permalink / raw)
  To: Julien Moutinho; +Cc: Dominique Martinet, meta

Julien Moutinho <julm+public-inbox@sourcephile.fr> wrote:
> With Inline::C, and with Nix's sandbox
> --------------------------------------
> 
> Using (in pkgs/servers/mail/public-inbox/default.nix):
> > preCheck = ''
> >   perl certs/create-certs.perl
> >   export HOME=$(mktemp -d)
> >   mkdir -p $HOME/.cache/public-inbox/inline-c
> > '';
> 
> $ nix -L build -f . public-inbox
> > [...]
> > perl5.34.0-public-inbox> t/lei-refresh-mail-sync.t .... ok
> Hangs like forever after this line, while on t/lei-sigpipe.t:
> 
> $ ps auxwwf
> > root     1755997  0.0  0.0 453172  2800 ?        Ssl  déc.04   0:03 nix-daemon --daemon
> > root     1811429  0.0  0.0 453652  1928 ?        Ssl  déc.04   0:00  \_ nix-daemon 1757028
> > root     1811455  0.0  0.0 453652  2004 ?        Ssl  déc.04   0:00  \_ nix-daemon 1757031
> > root     1839837  0.0  0.0 453652  1832 ?        Ssl  déc.04   0:00  \_ nix-daemon 1757027
> > root     1839841  0.0  0.0 453652  1996 ?        Ssl  déc.04   0:00  \_ nix-daemon 1757030
> > root     1839856  0.0  0.0 453652  1832 ?        Ssl  déc.04   0:00  \_ nix-daemon 1757029
> > root     3135741  0.0  0.2 603352 17080 ?        Ssl  01:05   0:00  \_ nix-daemon 3135672
> > nixbld1  3137110  0.0  0.0   5200  4072 ?        Ss   01:05   0:01      \_ bash -e /nix/store/qf3mzpvsmkrw963xchbivcci06078n13-builder.sh
> > nixbld1  3140619  0.0  0.0   4996  4012 ?        S    01:05   0:00          \_ make SHELL=/nix/store/l0wlqpbsvh1pgvhcdhw7qkka3d31si7k-bash-5.1-p8/bin/bash VERBOSE=y test
> > nixbld1  3140633  0.0  0.1  17188 13352 ?        S    01:05   0:01          |   \_ /nix/store/vslsa0l17xjcrdgm2knwj0z5hlvf73m7-perl-5.34.0/bin/perl -MExtUtils::Command::MM -MTest::Harness -e undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch') t/admin.t t/altid.t t/altid_v2.t t/cgi.t t/cmd_ipc.t t/content_hash.t t/dir_idle.t t/edit.t t/eml_content_disposition.t t/eml_content_type.t t/epoll.t t/extindex-psgi.t t/extsearch.t t/fake_inotify.t t/feed.t t/gcf2.t t/gcf2_client.t t/httpd.t t/idx_stack.t t/imap.t t/imap_searchqp.t t/imapd-tls.t t/imapd.t t/inbox_idle.t t/index-git-times.t t/indexlevels-mirror.t t/ipc.t t/kqnotify.t t/lei-auto-watch.t t/lei-convert.t t/lei-daemon.t t/lei-export-kw.t t/lei-externals.t t/lei-import-http.t t/lei-import-imap.t t/lei-import-maildir.t t/lei-import-nntp.t t/lei-import.t t/lei-index.t t/lei-inspect.t t/lei-lcat.t t/lei-p2q.t t/lei-q-kw.t t/lei-q-remote-import.t t/lei-q-save.t t/lei-q-thread.t t/lei-refresh-mail-sync.t t/lei-sigpipe.t t/lei-tag.t t/lei-up.t t/lei-watch.t t/lei.t t/lei_dedupe.t t/lei_external.t t/lei_lcat.t t/lei_mail_sync.t t/lei_overview.t t/lei_saved_search.t t/lei_store.t t/lei_to_mail.t t/lei_xsearch.t t/mbox_lock.t t/mbox_reader.t t/mdir_reader.t t/mime.t t/miscsearch.t t/net_reader-imap.t t/nntpd-tls.t t/nntpd.t t/nodatacow.t t/on_destroy.t t/plack.t t/psgi_attach.t t/psgi_bad_mids.t t/psgi_mount.t t/psgi_multipart_not.t t/psgi_scan_all.t t/psgi_search.t t/psgi_v2.t t/rename_noreplace.t t/reply.t t/search-thr-index.t t/shared_kv.t t/solver_git.t t/thread-index-gap.t t/uri_imap.t t/uri_nntps.t t/v2dupindex.t t/www_altid.t t/xcpdb-reshard.t t/www_static.t t/watch_multiple_headers.t t/watch_maildir_v2.t t/watch_maildir.t t/watch_imap.t t/watch_filter_rubylang.t t/view.t t/v2reindex.t t/v2mirror.t t/v2mda.t t/v2index-late-dupe.t t/v2-add-remove-add.t t/v1reindex.t t/v1-add-remove-add.t t/time.t t/thread-cycle.t t/spamcheck_spamc.t t/sigfd.t t/replace.t t/reindex-time-range.t t/qspawn.t t/purge.t t/psgi_text.t t/precheck.t t/over.t t/nulsubject.t t/nntpd-v2.t t/nntp.t t/multi-mid.t t/msgtime.t t/msgmap.t t/msg_iter.t t/mid.t t/mda_filter_rubylang.t t/mda.t t/linkify.t t/init.t t/indexlevels-mirror-v1.t t/inbox.t t/import.t t/imap_tracker.t t/hval.t t/httpd-unix.t t/httpd-https.t t/httpd-corner.t t/gzip_filter.t t/git.t t/filter_vger.t t/filter_subjecttag.t t/filter_rubylang.t t/filter_mirror.t t/filter_base.t t/emergency.t t/ds-poll.t t/ds-leak.t t/ds-kqxs.t t/config_limiter.t t/config.t t/address.t
> > nixbld1  3145719  0.0  0.4  44576 35640 ?        S    01:09   0:01          |       \_ t/lei-sigpipe.t
> > nixbld1  3145743  0.0  0.1  14388 10388 ?        S    01:09   0:00          |           \_ /nix/store/vslsa0l17xjcrdgm2knwj0z5hlvf73m7-perl-5.34.0/bin/perl -w -I/nix/store/vslsa0l17xjcrdgm2knwj0z5hlvf73m7-perl-5.34.0/lib/perl5/site_perl -I/nix/store/1hdx7bxjwqrfnalalkgbwi32l45h8z7b-perl5.34.0-Mail-IMAPClient-3.42/lib/perl5/site_perl -I/nix/st blib/script/lei q -q -t z:1..
> > nixbld1  3145724  0.0  0.5  50504 42160 ?        S    01:09   0:00          \_ lei-daemon /build/pi-lei-sigpipe-7522-WoHO/lei-daemon/xdg_run/lei/5.seq.sock
> > nixbld1  3145730  0.0  0.4  50092 39736 ?        S    01:09   0:00              \_ lei/store /build/pi-lei-sigpipe-7522-WoHO/lei-daemon/.local/share
> 
> t/lei-sigpipe.t is on:
> > 01:30:29.508334 clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fffffff5090) = 0 <1.000360>
> > 01:30:30.509837 clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fffffff5090) = 0 <1.000186>
> > 01:30:31.510259 clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fffffff5090) = 0 <1.000175>
> > [...]

Huh? but it's stuck in sysread() as noted below...

I'm not sure where clock_nanosleep(2) calls are coming from with
a 1s interval.  I doubt I'd ever loop clock_nanosleep(CLOCK_REALTIME
no matter how messed up my brain gets :P

I do use nanosleep(2) with a 100ms interval on sendmsg
ENOBUFS|ENOMEM|ETOOMANYREFS in Spawn.pm and that's a different
syscall.  From what I can tell, Mail::IMAPClient doesn't
clock_nanosleep, nor does Perl itself...

Sleeping on CLOCK_REALTIME seems wrong outside of a cron-like
scheduler...

> lei-daemon store is on:
> > 01:31:03.834708 epoll_wait(5,

OK, that's normal.

> 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...

> This test does succeed outside Nix's sandbox:
> $ (cd 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 )

OK, <snip>

> More surprisingly, it even succeeds when run manually
> inside the hanging Nix sandbox:

OK, <snip>

> Even more strange, Dominique was able to reproduce
> the hang this morning, but no longer tonight..

It's been a while, and I can't reproduce it.  Maybe this patch will help
with diagnosis:

------------8<---------
Subject: [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test

This may help diagnose a difficult-to-reproduce test failure on NixOS.

Link: https://public-inbox/meta/20211209013743.okzgim7bbrpahks7@sourcephile.fr/
---
 t/lei-sigpipe.t | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index d9738b07..6b2772a6 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -27,11 +27,17 @@ EOM
 		}
 
 		lei_ok(qw(import), $f) if $imported++ == 0;
-		open my $errfh, '+>', "$ENV{HOME}/stderr.log" or xbail $!;
+		open my $errfh, '+>>', "$ENV{HOME}/stderr.log" or xbail $!;
 		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);
 		close $w;
+		vec(my $rvec = '', fileno($r), 1) = 1;
+		if (!select($rvec, undef, undef, 30)) {
+			seek($errfh, 0, 0) or xbail $!;
+			my $s = do { local $/; <$errfh> };
+			xbail "lei q had no output after 30s, stderr=$s";
+		}
 		is(sysread($r, my $buf, 1), 1, 'read one byte');
 		close $r; # trigger SIGPIPE
 		$tp->join;

^ permalink raw reply related	[relevance 14%]

Results 1-7 of 7 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
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-09  1:37         ` Julien Moutinho
2022-02-17 21:02 14%       ` [PATCH] t/lei-sigpipe: attempt to improve diagnostics for stuck test Eric Wong
2022-02-20  1:38  5%         ` Julien Moutinho
2022-02-22  6:44  8%           ` Eric Wong
2022-02-27  4:15  8%             ` Julien Moutinho
2022-02-27  6:41  8%               ` Julien Moutinho
2022-02-27  7:23  8%                 ` Dominique Martinet
2022-02-27  8:04  8%                   ` Julien Moutinho

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).