Package: libhttp-server-simple-perl
Version: 0.52-2
Here's some of the code in Simple.pm:
while ( sysread( STDIN, my $buff, 1 ) ) {
last if $buff eq "\n";
$chunk .= $buff;
}
Suppose a signal arrives while this is executing, but doesn't cause
perl to exit or anything. Perl's signal handling machinery doesn't
set SA_RESTART nowadays. read(2) will return -1 setting errno to
EINTR. And then this will fail.
(Normal perl IO operations, so not sysread and syswrite, have the
:perlio layer which does retrying on EINTR, so are fine.)
IMO HTTP::Server::Simple ought to handle EINTR from sysread (returns
undef, sets $!) by restarting teh call.
Background:
I think this is the cause of a flaky test case
https://salsa.debian.org/dgit-team/dgit/-/work_items/34
It fails very rarely. The script uses HTTP::Server::Simple::Static
and has a periodic SIGALRM liveness check, so there is indeed some
slight risk of a signal arriving at just the wrong moment.
The full script is here
https://salsa.debian.org/dgit-team/dgit/-/blob/main/tests/http-static-server#L46
I could try to prepare a patch, if you like.
Thanks,
Ian.
--
Ian Jackson <[email protected]> These opinions are my own.
Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.