model-writtenrun 7182 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that repeated errors accessing asynchronous foreign partitions leaked file descriptors, eventually causing another error during transaction abort and an assertion failure #1.
- Tom Lane traced the leak to ExecAppendAsyncEventWait and proposed a PG_CATCH or PG_FINALLY block to release its short-lived WaitEventSet on error #2.
- Heikki Linnakangas committed the PG_TRY/PG_FINALLY fix with an error-path regression case and a corrected wait-event comment in 501cfd07da, using the matching patch #546884 from thread #47580; this thread supplied the bug report and initial analysis, and the commit explains that its test exercises the path without detecting leaks and that master would receive a different ResourceOwner-based fix.
- After the leak fix landed, Alexander demonstrated that opening enough foreign connections still exhausted descriptor slots and triggered the abort-time assertion, and Etsuro Fujita agreed to investigate #3 #4.
- Etsuro submitted a patch that catches errors in pgfdw_get_cleanup_result, restores the interrupt holdoff count and memory context, and reports warnings instead of rethrowing the error #5.
- Tom rejected suppressing arbitrary errors as unsafe, while Andres Freund agreed and suggested investigating descriptor accounting and avoiding WaitEventSet creation during error recovery #6 #7 #8.
- Tom determined that foreign connections consumed the AcquireExternalFD allowance, leaving WaitLatchOrSocket unable to allocate its temporary WaitEventSet during normal execution or cleanup; he proposed reserved descriptor accounting or retaining the set for reuse #9.
- Andres noted that long-lived WaitEventSets still require accounting and that reuse lacked socket replacement support, while Thomas Munro described related reuse work awaiting Windows changes #10 #11.
- Tom opposed deferring remote cleanup because open remote queries could cause undetected deadlocks, and Andres proposed reserving one descriptor or waiting for all connections together, while acknowledging that the latter was too large for a bugfix #12 #13.
- The thread ended without an accepted fix for the remaining abort-recovery problem: Tom prioritized the descriptor-accounting failure over speculative cleanup delays, while Etsuro warned that actual kernel allocation failures could still cause recursive errors even after accounting was fixed #14 #15.