Re: Trying to break online checksums with LLMs

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Trying to break online checksums with LLMs
Date: 2026-12-01 23:28:30
Message-ID: CAN4CZFO0B_4Z+nYB2dSdNZnzb1jozVVD8+=SHuTqyiQp+YRT0Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I threw Claude at this, and it pointed out that:

> That's pretty harmless, but there's also a simple fix: increment the
> "invocation number" when the launcher exits. That way, the worker will
> quickly see that the invocation number doesn't match and exit, even if
> the launcher fails to signal it.

This leaves a gap: a worker that is blocked in a lock when the
launcher exits still outlives it, as it doesn't get any abort checks.
With the injection point in 0002 hoolding the lancher before it learns
the PID, and another session holding ACCESS EXCLUSIVE on
pg_shdescription the worker is still waiting for the lock after the
launcher is already gone and data_checksums is already off.

v2-0002 is your fix plus a TerminateBackgroundWorker call and a few
related changes.

It also found that a very unlikely launcher failure in InitPostgres
can cause launcher_exit to kill a duplicate/next launcher's worker,
resulting in an additional error on master, or also an assertion with
v1-0001. This is handled in v2-0001 with a static flag, which is not
the nicest solution, but everything else that I thought would be
better ended up causing other issues. This is an even more unlikely
issue than the previous one, but I included the patch for it in case
we want to include it.

v2-0003 is your original test modified to reproduce the first issue.

> It's pretty artificial, and the
> consequence is very minor so the test doesn't seem worth committing.

+1, but it also doesn't take much time to run.

Attachment Content-Type Size
v2-0001-Don-t-clean-up-after-a-data-checksums-launcher-th.patch text/x-patch 4.3 KB
v2-0002-Bump-data-checksums-invocation-counter-when-launc.patch text/x-patch 5.5 KB
v2-0003-Add-test-for-data-checksums-worker-outliving-the-.patch text/x-patch 4.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-12-01 23:32:01 Re: EXPLAIN ANALYZE CREATE TABLE AS EXECUTE runs non-SELECT prepared statements
Previous Message Peter Smith 2026-12-01 23:20:21 Re: DOC: Minor updates for logical replication conflicts