public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Race condition in server-crash testing
Date: Sun, 3 Apr 2022 22:07:21 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Hi,

On 2022-04-04 00:50:27 -0400, Tom Lane wrote:
> My pet dinosaur gaur just failed [1] in
> src/test/recovery/t/022_crash_temp_files.pl, which does this:
> 
> -----
> my $ret = PostgreSQL::Test::Utils::system_log('pg_ctl', 'kill', 'KILL', $pid);
> is($ret, 0, 'killed process with KILL');
> 
> # Close psql session
> $killme->finish;
> $killme2->finish;
> 
> # Wait till server restarts
> $node->poll_query_until('postgres', undef, '');
> -----
> 
> It's hard to be totally sure, but I think what happened is that
> gaur hit the in-hindsight-obvious race condition in this code:
> we managed to execute a successful iteration of poll_query_until
> before the postmaster had noticed its dead child and commenced
> the restart.  The test lines after these are not prepared to see
> failure-to-connect.
> 
> It's not obvious to me how to remove this race condition.
> Thoughts?

Maybe we can use pump_until() with the psql that's not getting killed? With a
non-matching regex? That'd only return once the backend was killed by
postmaster, afaics?

Greetings,

Andres Freund






view thread (4+ messages)  latest in thread

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: Race condition in server-crash testing
  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