model-writtenrun 5957 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Lars Kanis reported that asynchronous Windows clients could lose the server's actual connection error and proposed explicitly closing the backend socket on Windows to avoid a reset at process exit #1.
- Tom Lane initially questioned sacrificing synchronous-close guarantees and suggested testing a half-close, while Thomas Munro distinguished process-exit resets from resets triggered by subsequent client writes #2 #3.
- Lars found that shutdown(SD_SEND) also closed gracefully but sent FIN before process termination, and neither linger settings nor client-side timing offered a reliable alternative for asynchronous clients #6.
- Thomas proposed retaining a socket handle in the postmaster, but Tom identified descriptor-exhaustion risks and traced the shutdown callbacks, concluding that socket_close() ran late enough for Lars's simpler patch to be acceptable #7 #9.
- Thomas cautioned that the patch would still leave a client-side race when a later query triggered a reset, and Lars's cross-machine tests confirmed that timing-dependent error loss also occurred between remote Windows systems #11 #13.
- Alexander Lakhin linked his earlier investigation, and Tom narrowed the remaining decision to whether shutdown() was necessary, preferring close alone because of ambiguous blocking behavior in the documentation #14 #15.
- Alexander tested the close-only fix with delayed reads, including on Windows 2012 R2, and could no longer reproduce the lost FATAL message; Tom then announced that he would commit that solution #16 #17.
- Tom committed the executable change from Lars's patchset #1 with rewritten explanatory comments as 6051857fc9, crediting Lars and Alexander as independent submitters and back-patching all supported branches.
- After the commit, Sergey Shinderuk reported a changed idle-session-timeout error and asked whether ECONNABORTED should be handled like ECONNRESET; further local and remote experiments showed that the observed errors depended on timing, and he withdrew that specific proposal #18 #19 #20.
- The thread ended with the fix committed and no further patch attached: Tom deferred action pending another discussion and anticipated potentially reverting explicit closes in the back branches because related changes appeared too invasive to back-patch, but no revert was recorded here #21.