| From: | Antonin Houska <ah(at)cybertec(dot)at> |
|---|---|
| To: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Race conditions during parallel worker (unclean) exit |
| Date: | 2026-09-10 12:54:01 |
| Message-ID: | 19840.1789044841@localhost |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Sami Imseih <samimseih(dot)pg(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-09-10 12:57:54 | Re: Reducing relcache memory usage: deduping index shapes |
| Previous Message | shveta malik | 2026-09-10 12:22:02 | Re: Review items for EXCEPT TABLE publication |