Re: Stale hash entries when reusing an auxiliary resource owner

From: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, hlinnaka(at)iki(dot)fi
Subject: Re: Stale hash entries when reusing an auxiliary resource owner
Date: 2026-11-02 16:43:00
Message-ID: CAPsk3_Bq6jC-L6YwoJqYD+AmMr7pRnZcSyZnZkEvu8MoJ4zgNg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> The fix looks good to me. However, when I tried running the test with the fix reverted, the test hung indefinitely, which doesn't seem desirable. Ideally, the test should fail rather than hang when the fix is absent. It’s late here, I haven’t spent time debugging why the test hang.

Thanks for testing. The hang is an expected consequence of the bug. The
resource counts are reset after release, but the hash slots remain
occupied. On reuse, the low counts can prevent a resize even when there
are no free slots, so ResourceOwnerAddToHash() keeps probing
indefinitely.

I have adjusted the test cases in v2 so that they still expose the bug
without hanging when the fix is absent.

I verified that the revised regression passes with the fix and fails
promptly with duplicate-release errors when only the fix is reverted.

Attached is v2.

---
Regards,
Jingtang

Attachment Content-Type Size
v2-aux-resource-owner-reuse.patch application/octet-stream 7.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-11-02 16:48:12 Re: Internal error codes triggered by regression tests and user queries, take 2
Previous Message Jingtang Zhang 2026-11-02 16:40:15 [PATCH] Periodically refresh database frozen IDs during autovacuum