model-writtenrun 5781 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Michael Harris reported deadlocks remaining undetected for hours after upgrading to PostgreSQL 14.1 and declarative partitioning; Alvaro Herrera suggested capturing complete transaction logs to investigate the unexpected locks #1 #4 #5.
- Michael Lewis suggested detaching partitions concurrently to reduce contention, and Michael Harris agreed this was worth trying, while the failure to detect deadlocks remained unexplained #6 #8 #9.
- Using debugger traces, Michael Harris traced the unexpected parent-table lock to partition-constraint planning and showed that manually triggering the deadlock check released the deadlock, pointing to failed timeout scheduling rather than failed deadlock detection #10.
- Michael Harris identified a custom function that overwrote PostgreSQL's alarm timer, explaining why the PostgreSQL 14 timer optimization could leave a backend without working timeouts; Simon Riggs emphasized fixing the custom code and suggested a test case, while Tom Lane initially believed the existing expired-timeout check provided recovery #11 #12 #13.
- Michael Harris explained that canceling timeouts before expiration and scheduling new ones in the future bypassed that recovery check indefinitely, proposing a check against signal_due_at and questioning its missing volatile qualifier #14.
- Tom Lane accepted the diagnosis and attached a patch that clears signal_pending when the expected interrupt is more than 10 milliseconds overdue and makes signal_due_at volatile, keeping recovery separate from the existing scheduling condition for clarity #15.
- Michael Harris tested the patch with a simulation and confirmed through debugger inspection that timer state recovered after a missed interrupt; he could not practically reproduce the rare failure with the full application, and Tom Lane acknowledged the successful testing #16 #17.
- The thread ended with Simon Riggs requesting a PostgreSQL Licence declaration for the simulation so it could become a permanent test case; no response resolving that request appears in the supplied messages #18.
- Tom Lane subsequently committed the attached patch with comment-only edits, jointly crediting Michael Harris and himself and backpatching the fix to PostgreSQL 14; the commit contains no permanent regression test #15 d37776e451.