pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Handle cancel requests with PID 0 gracefully
2+ messages / 1 participants
[nested] [flat]

* pgsql: Handle cancel requests with PID 0 gracefully
@ 2025-07-29 21:51 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2025-07-29 21:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle cancel requests with PID 0 gracefully

If the client sent a query cancel request with backend PID 0, it
tripped an assertion. With assertions disabled, you got this in the
log instead:

    LOG:  invalid cancel request with PID 0
    LOG:  wrong key in cancel request for process 0

Query cancellations don't even require authentication, so we better
tolerate bogus requests. Fix by turning the assertion into a regular
runtime check.

Spotted while testing libpq behavior with a modified server that
didn't send BackendKeyData to the client.

Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/613f64712257d4b94e068e77fb0593e0a71d8df1

Modified Files
--------------
src/backend/storage/ipc/procsignal.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Handle cancel requests with PID 0 gracefully
@ 2025-07-29 21:51 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2025-07-29 21:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle cancel requests with PID 0 gracefully

If the client sent a query cancel request with backend PID 0, it
tripped an assertion. With assertions disabled, you got this in the
log instead:

    LOG:  invalid cancel request with PID 0
    LOG:  wrong key in cancel request for process 0

Query cancellations don't even require authentication, so we better
tolerate bogus requests. Fix by turning the assertion into a regular
runtime check.

Spotted while testing libpq behavior with a modified server that
didn't send BackendKeyData to the client.

Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fce7da1e73853b21a8084e645ac39354c1476261

Modified Files
--------------
src/backend/storage/ipc/procsignal.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-07-29 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-29 21:51 pgsql: Handle cancel requests with PID 0 gracefully Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-07-29 21:51 pgsql: Handle cancel requests with PID 0 gracefully Heikki Linnakangas <heikki.linnakangas@iki.fi>

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