Buffer pin leak in hash index bucket splits

Started by Peter Geogheganabout 1 month ago2 messageshackers
Jump to latest

During review of what became bugfix commit 173cf85a, Claude Code found
an unrelated bug in hash index bucket splits.

Attached bug fix patch adds an isolation test demonstrating the
problem; with the fix itself reverted, running the Claude-authored
test shows a buffer pin leak. The leak is caused by _hash_finish_split
neglecting to release a pin on the primary bucket buffer in its
failure paths, used when a cleanup lock cannot be acquired. The fix
just has _hash_finish_split release the pin in those paths.

I doubt that it's worth committing the test itself. It'll add test
cycles for a trivial issue, that's unlikely to ever regress in the
future.

--
Peter Geoghegan

Attachments:

t254141_1
v1-0001-Fix-hash-bucket-split-buffer-pin-leak.patchapplication/octet-stream; name=v1-0001-Fix-hash-bucket-split-buffer-pin-leak.patchDownload+135-1
#2Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Peter Geoghegan (#1)
Re: Buffer pin leak in hash index bucket splits

Hi,

On Sun, 11 Oct 2026 at 10:12, Peter Geoghegan <pg@bowt.ie> wrote:

During review of what became bugfix commit 173cf85a, Claude Code found
an unrelated bug in hash index bucket splits.

Attached bug fix patch adds an isolation test demonstrating the
problem; with the fix itself reverted, running the Claude-authored
test shows a buffer pin leak. The leak is caused by _hash_finish_split
neglecting to release a pin on the primary bucket buffer in its
failure paths, used when a cleanup lock cannot be acquired. The fix
just has _hash_finish_split release the pin in those paths.

Thanks for the report and patch. The fix LGTM.

I doubt that it's worth committing the test itself. It'll add test
cycles for a trivial issue, that's unlikely to ever regress in the
future.

+1 on not having one for this.

Regards,
Ayush