Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore

Jelte Fennema-Nio <postgres@jeltef.nl>

From: "Jelte Fennema-Nio" <postgres@jeltef.nl>
To: "Heikki Linnakangas" <hlinnaka@iki.fi>
Cc: "PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>, "Alvaro Herrera" <alvherre@alvh.no-ip.org>, "Jacob Champion" <jacob.champion@enterprisedb.com>
Date: 2026-07-07T07:54:09Z
Lists: pgsql-hackers

Attachments

On Tue Jul 7, 2026 at 12:12 AM CEST, Heikki Linnakangas wrote:
> This relies on the signal to interrupt select(), but I'm afraid that's 
> not guaranteed on all platforms. Also, there's a race condition if the 
> signal arrives *just* before you call select(). That's what the 
> "self-pipe hack" is for, see comments at waiteventset.c.

Ugh yes you're right. The comment above that block told me otherwise and
I didn't question it. Attached is a new version that improves the
comment and starts using the same 1 second poll on all platforms.