public inbox for [email protected]  
help / color / mirror / Atom feed
From: Noah Misch <[email protected]>
To: Alexander Lakhin <[email protected]>
Cc: [email protected]
Cc: Robert Haas <[email protected]>
Subject: Re: IPC::Run accepts bug reports
Date: Fri, 4 Oct 2024 11:57:48 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

On Fri, Oct 04, 2024 at 02:00:00PM +0300, Alexander Lakhin wrote:
> sub _read {
> ...
>     my $r = POSIX::read( $_[0], $s, 10_000 );
>     croak "$!: read( $_[0] )" if not($r) and !$!{EINTR};
> 
> That is, EINTR kind of recognized as an expected error, but there is no
> retry in this case. Thus, with the following modification, which simulates
> read() failed with EINTR:
>  sub _read {
>      confess 'undef' unless defined $_[0];
>      my $s = '';
> -    my $r = POSIX::read( $_[0], $s, 10_000 );
> +    my $r;
> +if (int(rand(100)) == 0)
> +{
> +   $r = 0;  $! = Errno::EINTR;
> +}
> +else
> +{
> +    $r = POSIX::read( $_[0], $s, 10_000 );
> +}
>      croak "$!: read( $_[0] )" if not($r) and !$!{EINTR};
> 
> I can see failures like the one in question when running that test.

That makes sense.  Would you file this at
https://github.com/cpan-authors/IPC-Run/issues?  I suppose that code should
become roughly:

  do { $r = POSIX::read(...) } while (!defined($r) && $!{EINTR});
  croak ... unless defined($r);

> Perhaps, I could reproduce the issue with a program, that sends signals
> to running (pgbench) processes (and thus interrupts read()), if it makes
> sense.

That should work.  Best would be an IPC::Run test case, like the existing
t/eintr.t that makes select() report EINTR.  That said, IPC::Run could adopt
the retry without a test.

> [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=indri&dt=2024-10-02%2002%3A34%3A16






view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: IPC::Run accepts bug reports
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox