model-writtenrun 5829 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Sergey Cherkashin proposed periodically checking client connections during long-running queries so abandoned work could be cancelled, initially enabling checks every second in #1.
- Tom Lane identified Linux-specific flags, unread-data and TLS complications, timeout-management problems, and an unacceptable enabled-by-default setting in #2; Sergey responded with a disabled-by-default revision and Windows and SSL adjustments in #4.
- Thomas Munro tested the feature on multiple systems, while Tatsuo Ishii suggested sending a parameter-status message instead; discussion distinguished abrupt client closure from network loss requiring TCP keepalives and questioned whether sending messages was safe at arbitrary interrupt points #5 #7 #9 #10 #11.
- Tatsuo Ishii measured performance degradation and inconsistent settings, Tom Lane traced unnecessary timer rescheduling, and Konstantin Knizhnik confirmed timer overhead and suggested polling for hangups; the work stalled without an active author #13 #16 #17 #18.
- After the long gap, Thomas Munro revived the patch with a rebase in #19, then fixed latch signaling, moved timer rearming out of the signal handler, avoided idle-session wakeups, and simplified the test in #20.
- Thomas incorporated Zhihong Yu's interval-check feedback and earlier documentation findings, added error reporting and an active-timeout guard, and explicitly became co-author in #22.
- Thomas removed race-prone TAP tests and explored secure_read-based lookahead to detect a buffered terminate message in #23, consolidating that approach after SSL and non-SSL testing in #24, while acknowledging that deeper pipelined requests could still defeat it.
- Revisiting Konstantin's polling suggestion with Andres Freund led Thomas to replace lookahead with POLLHUP/POLLRDHUP checks in #26, solving the buffered-data problem but exposing unreliable behavior on platforms lacking POLLRDHUP #27.
- Maksim Milyutin supplied cleanup and highlighted leftover code, missing tests, portability failures, and absent benchmarks in #28; Thomas initially favored the portable lookahead approach but ultimately chose the simpler POLLRDHUP-dependent implementation in #30.
- Takayuki Tsunakawa requested proper socket-error reporting and include guards, and Bharath Rupireddy requested formatting changes; Thomas incorporated these in #33, and Takayuki then called the patch committable #31 #32 #35.
- The original feature landed as c30f54ad73 from #33 with only a comment and commit-message edit; Thomas reported no pgbench regression and explained that a reliable multi-connection TAP test remained unresolved in #36.
- Thomas opened a separate portability series in #37, exposing socket shutdown through WaitEventSet using poll, epoll, and kqueue so the existing feature could support more operating systems.
- The rebased series added a capability query and rejected unsupported GUC settings in #38; Zhihong Yu reviewed the event checks, and Maksim Milyutin successfully tested three disconnection scenarios on Linux and FreeBSD #39 #41 #42.
- Thomas addressed event-array and state-restoration concerns with a smaller result buffer and PG_FINALLY() in #43, while leaving apparent Windows FD_CLOSE support out pending stronger evidence.
- Andres Freund challenged temporary latch suppression in #44, prompting a three-patch version that changed WaitEventSetWait() to report socket events alongside an already-set latch in #46.
- Andres then objected to the extra system calls and API implications in #48, so Thomas introduced an opt-in low-priority-latch mechanism in #50.
- Thomas abandoned the low-priority API as too complicated and narrowly useful, returning to temporary latch suppression with PG_FINALLY() in #51.
- Andres explained why callers cannot require latch state to survive interrupt processing or errors in #52, allowing Thomas to simplify the final integration to reset obstructing latches and retry without restoration in #53.
- Both patches from #53 landed unchanged as 50e570a59e for WL_SOCKET_CLOSED infrastructure and cba5b994c9 for client-connection integration.
- The thread closed with both portability patches pushed after extensive cross-platform testing; Thomas confirmed that apparent Windows support had been an RST-related testing artifact, leaving Windows unsupported and its implementation unresolved #54.