model-writtenrun 1518 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Rahila Syed reported that a FATAL error outside a transaction could leave a dshash lock held until after its DSM segment was detached, and supplied a background-worker reproducer and an early LWLockReleaseAll() fix in #1.
- Amit Langote questioned whether releasing locks before callbacks was safe and suggested placing the release immediately before DSM shutdown in #2, with Dilip Kumar supporting that placement in #3.
- Andres Freund explained that callbacks themselves could deadlock unless existing LWLocks were released first, endorsed unconditional release at the start of shmem_exit(), and requested documentation that LWLockReleaseAll() works before initialization in #4 and #6.
- Amit retained Rahila’s original placement, added the initialization comment and revised the shutdown comments in #8, then supplied a missing include in #9; he left out a regression test because reproducing the background-worker FATAL scenario would be complex and potentially fragile.
- Rahila supplied a comment explaining that callbacks can acquire locks after the release in #10 and clarified the existing callback behavior in #12; Amit refined the wording in #13 and consolidated it with a corrected commit message in #15.
- Álvaro Herrera approved the patch and requested an assertion that all locks had been released in #16, which Amit accepted in #17.
- Álvaro also suggested separately moving the release inside ProcKill() in #16, but Tom Lane identified a possible self-deadlock in #18, leading Amit to leave ProcKill() unchanged in #19 and #20.
- Amit committed #15 with Álvaro’s assertion and corresponding message edits as 9cbb1d21d6, with backports through PostgreSQL 14, and confirmed completion in the thread’s final message #21.