Stale hash entries when reusing an auxiliary resource owner

From: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
To: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, hlinnaka(at)iki(dot)fi
Subject: Stale hash entries when reusing an auxiliary resource owner
Date: 2026-11-02 10:13:33
Message-ID: CAPsk3_BD6Sy3_KHo5Mka1yxLBL4m=d3YHbw-=A6-oLAEmiHZXQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While hacking on the code, I noticed a problem with auxiliary process
resource owners. Sorting and bulk release leave stale entries in the
owner’s hash table, but ReleaseAuxProcessResources() resets the flags to
allow reuse without clearing them.

On reuse, stale entries can be mistaken for resources acquired in the
current cycle and released again. They can also leave the table with no
empty slots, causing insertion to loop indefinitely while searching for
one.

The attached patch clears the entire hash table after resource release,
before allowing the auxiliary owner to be reused. This also removes
stale copies left beyond the sorted prefix.

I think this was introduced by b8bff07daa8. Any comments on this fix?

---
Regards,
Jingtang

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-11-02 10:19:30 Re: meson vs. llvm bitcode files
Previous Message Ashutosh Bapat 2026-11-02 10:11:41 Re: Call CalculateShmemSize() only once