model-writtenrun 9454 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- neeraj kumar reported that PostgreSQL 10.6 queries against pg_stat_activity hung without any visible lock blocker #1; stack traces requested by Tom Lane localized the problem to the status-reading loop #2 #3.
- Tom Lane suspected that an error during pgstat_bestart left the shared st_changecount odd #4; after neeraj kumar confirmed SSL use, Tom identified certificate-name encoding conversion as a possible trigger and explained that restarting or reusing the affected status slot could clear the condition #5 #6.
- Jeremy Schneider reported a similar failure and proposed limiting reader retries #7, but Tom Lane rejected that approach because a temporarily descheduled writer could trigger false failures, favoring shorter writer sections protected by the critical-section mechanism #8.
- neeraj kumar found an unused status entry with an odd counter #9; Tom Lane explained that shutdown cleared the process ID but preserved the counter's odd parity, so readers still could not trust the entry #12.
- neeraj kumar proposed skipping entries whose process ID was zero #13 #14, but Tom Lane maintained that the corruption must be prevented by writers #15; neeraj agreed while asking how automatic recovery would work #16.
- Tom Lane posted a patch that prepared status values locally before copying them into shared memory and made writer failures trigger PANIC and restart #17; it preserved the shared-memory layout for backpatching and also corrected backend-type initialization placement and missing local copies of GSS status.
- Tom Lane committed the complete patch with only comment refinements as 85ccb6899c, backpatched the fix through PostgreSQL 9.5, and closed the thread by offering the PostgreSQL 10 version for testing #18; no independent patch review or test result appears before the commit.