model-writtenrun 8056 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Victor Spirin reported intermittent missing stdout output after libpq connection teardown on multicore Windows systems and proposed flushing every snprintf.c output buffer #1; Tom Lane objected to the broad workaround and called for investigating the cause, noting similar ECPG failures #2.
- Victor found that WSACleanup alone could reproduce the effect #3, and Tom later identified a similar Node.js report that suggested an underlying Windows timing problem #4.
- Alexander Lakhin supplied a standalone Winsock reproducer and TAP stress test, isolating nonblocking socket setup and WSACleanup as necessary ingredients #5.
- Tom considered flushing all streams around WSACleanup but proposed instead initializing Winsock once and never cleaning it up #6; Alexander demonstrated that stderr and ordinary files also lost output, confirmed that flushing prevented the failure, and raised the documented requirement to balance startup and cleanup calls #7.
- Andrew Dunstan supported trying the cleanup-removal approach #8, while Tom argued that process exit already handles cleanup and repeated DLL unloading is wasteful #9; Tom then posted a replacement patch after finding existing PostgreSQL programs already omitted WSACleanup #10.
- Tom committed #10 unchanged as 7d00a6b2de, removing WSACleanup from libpq and pg_dump and deleting the obsolete application workaround documentation; neither the original fflush workaround nor the diagnostic test module was included.
- Tom also raised libpq's outdated Winsock API request in #10 and implemented that separate discussion-derived change in d5a9a661fc, updating both libpq and thread_test to request version 2.2.
- After both commits, Alexander reported 200 successful ECPG test iterations with the cleanup fix, followed by a descriptor error during another run #11; Tom identified historical examples and suspected a separate descriptor-locking problem #12 #13.
- Alexander confirmed that the remaining descriptor and connection failures contained actual error output rather than missing output #14; his testing persuaded Tom to proceed with backpatching the cleanup fix without waiting months for buildfarm evidence #15.
- The thread ended with both changes committed and the original output-loss problem considered resolved or substantially reduced, while the distinct ECPG descriptor and connection failures remained for investigation #16.