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

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, "Jacob Champion" <jacob(dot)champion(at)enterprisedb(dot)com>
Subject: Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore
Date: 2026-07-07 07:54:09
Message-ID: DJS6DTW9NJUB.FKBYKWOWB0WG@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Attachment Content-Type Size
v9-0001-psql-Replace-cancel_pressed-with-CancelRequested.patch text/x-patch 21.9 KB
v9-0002-fe_utils-Simplify-cancel-logic-in-wait_on_slots.patch text/x-patch 2.9 KB
v9-0003-Move-Windows-pthread-compatibility-functions-to-s.patch text/x-patch 2.8 KB
v9-0004-Don-t-use-deprecated-and-insecure-PQcancel-psql-a.patch text/x-patch 42.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-07-07 08:02:44 Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup
Previous Message jian he 2026-07-07 07:49:48 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions