[HACKERS] Race conditions with WAL sender PID lookups - Mailing list pgsql-hackers

From Michael Paquier
Subject [HACKERS] Race conditions with WAL sender PID lookups
Date
Msg-id CAB7nPqTWYqtzD=LN_oDaf9r-hAjUEPAy0B9yRkhcsLdRN8fzrw@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] Race conditions with WAL sender PID lookups  (Masahiko Sawada <sawada.mshk@gmail.com>)
Re: [HACKERS] Race conditions with WAL sender PID lookups  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] Race conditions with WAL sender PID lookups  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
Hi all,

I had my eyes on the WAL sender code this morning, and I have noticed
that walsender.c is not completely consistent with the PID lookups it
does in walsender.c. In two code paths, the PID value is checked
without holding the WAL sender spin lock (WalSndRqstFileReload and
pg_stat_get_wal_senders), which looks like a very bad idea contrary to
what the new WalSndWaitStopping() does and what InitWalSenderSlot() is
doing for ages.

Any thoughts about the patch attached to make things more consistent?
It seems to me that having some safeguards would be nice for
robustness.

That's an old bug, so I am adding that to the next CF.
Thanks,
-- 
Michael

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Removal of plaintext password type references
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] [PATCH v2] Progress command to monitor progression oflong running SQL queries