pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: Sami Imseih <samimseih.pg@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Race conditions during parallel worker (unclean) exit
Date: Thu, 10 Sep 2026 14:54:01 +0200
Message-ID: <19840.1789044841@localhost> (raw)
In-Reply-To: <CAN12+YJWWfhRZT7MdpD178=kARuXufeDAGheELa=VY8nJqs=yw@mail.gmail.com>
References: <64338.1788881902@localhost>
	<CAN12+YLh4WTE0aEUWtvLOXWOuCGnNY2yunv98s9A0S9DQLRtCQ@mail.gmail.com>
	<15111.1788979352@localhost>
	<CAN12+YJWWfhRZT7MdpD178=kARuXufeDAGheELa=VY8nJqs=yw@mail.gmail.com>

Sami Imseih <samimseih.pg@gmail.com> wrote:

> > > It seems cleaner to introduce a separate message for this case, maybe
> > > "PqMsg_ParallelAborted", and keep the existing
> > > "ERROR: lost connection to parallel worker" message.
> >
> > I'm not sure this is worth adjusting the FE/BE protocol. I'd prefer regular
> > ERROR message (PqMsg_ErrorResponse), but only in some minimalistic form. The
> > worker would only send the message, w/o doing any error handling itself.
> 

> I was thinking of PqMsg_ParallelAborted because we have precedent already
> with PqMsg_Progress which was introduced in f1889729dd3a as the 'P' message
> for parallel index progress reported, but later converted to a macro in
> a99cc6c6b4b.

I realize now that new message type for communication between background
worker and the leader backend actually shouldn't need the protocol version to
be bumped - see commit f1889729dd3a. However, when adding a new message type,
I'd use the opportunity to stop using PqMsg_Terminate in the background
worker: per documentation, this one should be sent by frontend to backend.

A new message, e.g. PqMsg_WorkerExit, would contain status code. The worker
would set zero status code when sending the message at the end of
ParallelWorkerMain(), and non-zero in ParallelWorkerShutdown(). Does that make
sense to you?

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com






view thread (6+ messages)  latest in thread

Message-ID: <19840.1789044841@localhost>
Permalink:  ../19840.1789044841@localhost/
Also on:    postgresql.org/message-id/19840.1789044841@localhost

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: ah@cybertec.at, samimseih.pg@gmail.com
  Subject: Re: Race conditions during parallel worker (unclean) exit
  In-Reply-To: <19840.1789044841@localhost>
  References: <64338.1788881902@localhost> <CAN12+YLh4WTE0aEUWtvLOXWOuCGnNY2yunv98s9A0S9DQLRtCQ@mail.gmail.com> <15111.1788979352@localhost> <CAN12+YJWWfhRZT7MdpD178=kARuXufeDAGheELa=VY8nJqs=yw@mail.gmail.com> <19840.1789044841@localhost>

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

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