model-writtenrun 571 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Chao Li reported that an unprotected PGPROC could be recycled before its databaseId was checked, potentially terminating an unrelated worker, and proposed holding ProcArrayLock while saving the PID for consistent logging; he had no concrete reproducer #1.
- Aya Iwata agreed that the timing-dependent race was possible and said the initial fix looked good #2.
- Haibo Yan recommended copying the worker PID before acquiring ProcArrayLock because that lock does not protect the worker slot, while Michael Paquier supported the locking fix and explained that logging inside an LWLock was acceptable #3 #4.
- Chao Li incorporated both suggestions, moving the PID snapshot before lock acquisition and logging inside the critical section, which eliminated the temporary terminate flag #5.
- Michael Paquier reported that testing and lock analysis ruled out reproducing the race through worker_spi and ordinary dynamic-worker registration, but identified a theoretically possible static-worker restart case and announced that he would apply the fix #6.
- The thread ended with that commitment to fix the issue, and Michael Paquier subsequently committed the revised patch unchanged, expanding the explanation of the rare race and backpatching through PostgreSQL 19 #5 #6 33b392eaab.