#1143215#5
Date:
2026-08-01 00:06:11 UTC
From:
To:
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.

#1143215#12
Date:
2026-08-01 22:20:46 UTC
From:
To:
Thanks for you bug report, which I've forwarded to
https://rt.cpan.org/Ticket/Display.html?id=180563

Given that upstream doesn't seem to be very active …

… this would be great.


Cheers,
gregor