Bug#1012073: perl: restoring default signal handler may warn with 'SIGTERM handler "DEFAULT" not defined'
Damyan Ivanov
dmn at debian.org
Sun May 29 18:38:40 BST 2022
Package: perl
Version: 5.34.0-4
Severity: normal
Control: block 923829 by -1
Hi,
While infestigating a random FTBFS in starlet (#923829), it appeared to me that
the problem is actually in perl. To reproduce te issue, t/12bad_request_line.t
needs to be run in a loop with the following change:
(starlet packaging repo is at
ssh://git@salsa.debian.org/perl-team/modules/packages/starlet.git)
-------------------------------------------
diff --git a/t/12bad_request_line.t b/t/12bad_request_line.t
index 61b4e7b..bdc8368 100644
--- a/t/12bad_request_line.t
+++ b/t/12bad_request_line.t
@@ -22,7 +22,7 @@ test_tcp(
my $port = shift;
local $SIG{__WARN__} = sub {
ok 0, "No warnings";
- diag @_;
+ diag Carp::longmess(@_);
};
my $loader = Plack::Loader->load('Starlet', port => $port);
$loader->run(sub { [200, ['Content-Type' => 'text/plain'], ['OK']] });
-------------------------------------------
A sample loop is this:
while prove -l t/12bad_request_line.t; do date; done
Running this simultaneously in several terminals may help triggering the
failure.
Eventually it fails with:
# Failed test 'No warnings'
# at t/12bad_request_line.t line 24.
# SIGTERM handler "DEFAULT" not defined.
# at /usr/share/perl5/Parallel/Prefork.pm line 71.
# Parallel::Prefork::start(Parallel::Prefork=HASH(0x55cd856355b8)) called at .../lib/Plack/Handler/Starlet.pm line 78
# Plack::Handler::Starlet::run(Plack::Handler::Starlet=HASH(0x55cd849b0ad8), CODE(0x55cd8562ac98)) called at t/12bad_request_line.t line 28
# main::__ANON__(33415) called at /usr/share/perl5/Test/TCP.pm line 100
# Test::TCP::start(Test::TCP=HASH(0x55cd8562aed8)) called at /usr/share/perl5/Test/TCP.pm line 82
# Test::TCP::new("Test::TCP", "code", CODE(0x55cd8562aab8)) called at /usr/share/perl5/Test/TCP.pm line 28
# Test::TCP::test_tcp("client", CODE(0x55cd854306b0), "server", CODE(0x55cd8562aab8)) called at t/12bad_request_line.t line 31
# Looks like you failed 1 test of 2.
t/12bad_request_line.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
The lines in Parallel::Prefork where the warning comes from are:
https://salsa.debian.org/perl-team/modules/packages/libparallel-prefork-perl/-/blob/master/lib/Parallel/Prefork.pm#L71
...
68 unless ($pid) {
69 # child process
70 $self->{in_child} = 1;
71 $SIG{$_} = 'DEFAULT' for keys %{$self->trap_signals};
72 $SIG{CHLD} = 'DEFAULT'; # revert to original
73 exit 0 if $self->signal_received;
...
Seems perfectly normal to me - signal handlers are reset in the forked child.
The only plausible source I find is line 3522 of mg.c:
https://salsa.debian.org/perl-team/interpreter/perl/-/blob/debian-5.34/mg.c#L3522
and here my idea of what is going on vanishes. I hope this is enough as a clue.
-- Damyan
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 5.17.0-3-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages perl depends on:
ii dpkg 1.21.8
ii libperl5.34 5.34.0-4
ii perl-base 5.34.0-4
ii perl-modules-5.34 5.34.0-4
Versions of packages perl recommends:
ii netbase 6.3
Versions of packages perl suggests:
pn libtap-harness-archive-perl <none>
ii libterm-readline-gnu-perl 1.42-2+b1
ii libterm-readline-perl-perl 1.0303-2.1
ii make 4.3-4.1
ii perl-doc 5.34.0-4
-- no debconf information
More information about the Perl-maintainers
mailing list