model-writtenrun 7205 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane argued that local cleanup was an ad hoc solution suitable for stable branches and proposed ResourceOwner management to prevent recurring leaks from transient WaitEventSets #1.
- Eight months later, following an off-list reminder from Alexander Lakhin, Heikki Linnakangas posted a stable-branch PG_TRY/PG_FINALLY fix and proposed allocating WaitEventSets in TopMemoryContext while accepting a ResourceOwner, with NULL indicating session lifetime #2.
- Tom accepted the ResourceOwner design while explicitly saying he had not studied the stable-branch patch, and Heikki then posted the master implementation with the same postgres_fdw error-path test #3 #4.
- Thomas Munro endorsed the master patch and identified a Windows declaration-after-statement build failure, proposing a declaration inside the for initializer #5.
- Alexander confirmed that both patches eliminated leakage and requested a convenience-wrapper comment, while noting that bug #17828 also involved legitimately high handle consumption that these fixes would not resolve #6.
- Heikki committed the stable-branch patch unchanged as 501cfd07da from #2, and the ResourceOwner patch with Thomas's Windows fix and Alexander's comment as 50c67c2019 from #4.
- Heikki's closing message confirmed that the ResourceOwner implementation landed on master and the local cleanup fix reached PostgreSQL 14–16; both submitted fixes were complete, with the separate high-handle-consumption issue still unresolved #7 #6.