model-writtenrun 9041 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Dongming Liu opened the thread with two suspected synchronous-replication bugs and a patch: a backend-exit queue-deletion race and a proposed cancellation-cleanup reorder to prevent interrupts from skipping cleanup #1.
- Kyotaro Horiguchi confirmed the exit race but explained that transaction commit already holds interrupts, making the cancellation reorder unnecessary #3; Dongming subsequently traced his exception to calling SyncRepWaitForLSN() elsewhere without HOLD_INTERRUPTS #8.
- Michael Paquier retained Dongming's exit-race fix, replaced the cancellation reorder with an interrupt-holdoff assertion, and added assertions for SyncRepLock ownership #5.
- Kyotaro questioned assertions in static helpers, examined surrounding synchronization, and supplied an independent comment typo fix #6; Michael defended the defensive checks and explained that the WAL sender can safely read information for which it is the sole writer #13.
- Fujii Masao observed that the revised fix would acquire an exclusive lock on every backend exit and proposed retaining the unlocked preliminary check while repeating it under the lock #10; Kyotaro endorsed that implementation #11, and Michael accepted it #12.
- Kyotaro's separate comment correction from #6 landed unchanged as f921ea624e, which Michael announced in #13.
- Michael posted a revised combined patch adopting Fujii's double-check logic and adding comments, while reporting no measurable performance difference in his pgbench connection tests #14; Fujii and Dongming approved it #15 #16.
- Michael split #14 into the exit-race fix 20345197ff, with only comment reflow, and the unchanged assertion hunks e174f699c4.
- The thread ended with Michael confirming that the race fix was backpatched through PostgreSQL 9.4 and the assertions were restricted to the development branch #17; all retained changes had landed, while the unnecessary cancellation reorder had been dropped.