Re: BUG #17828: postgres_fdw leaks file descriptors on error and aborts aborted transaction in lack of fds
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org, Etsuro Fujita <etsuro.fujita@gmail.com>
Date: 2023-03-09T16:57:55Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes: > The following script: > [ leaks a file descriptor per error ] Yeah, at least on platforms where WaitEventSets own kernel file descriptors. I don't think it's postgres_fdw's fault though, but that of ExecAppendAsyncEventWait, which is ignoring the possibility of failing partway through. It looks like it'd be sufficient to add a PG_CATCH or PG_FINALLY block there to make sure the WaitEventSet is disposed of properly --- fortunately, it doesn't need to have any longer lifespan than that one function. regards, tom lane
Commits
-
Fix resource leak when a FDW's ForeignAsyncRequest function fails
- 555276f85940 14.11 landed
- 481d7d1c01c6 15.6 landed
- 501cfd07dac6 16.2 landed