postgresql/src/include/storage
Heikki Linnakangas 50c67c2019 Use ResourceOwner to track WaitEventSets.
A WaitEventSet holds file descriptors or event handles (on Windows).
If FreeWaitEventSet is not called, those fds or handles are leaked.
Use ResourceOwners to track WaitEventSets, to clean those up
automatically on error.

This was a live bug in async Append nodes, if a FDW's
ForeignAsyncRequest function failed. (In back branches, I will apply a
more localized fix for that based on PG_TRY-PG_FINALLY.)

The added test doesn't check for leaking resources, so it passed even
before this commit. But at least it covers the code path.

In the passing, fix misleading comment on what the 'nevents' argument
to WaitEventSetWait means.

Report by Alexander Lakhin, analysis and suggestion for the fix by
Tom Lane. Fixes bug #17828.

Reviewed-by: Alexander Lakhin, Thomas Munro
Discussion: https://www.postgresql.org/message-id/472235.1678387869@sss.pgh.pa.us
2023-11-23 13:31:36 +02:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
backendid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
barrier.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
block.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
buf.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
buf_internals.h Ensure we use the correct spelling of "ensure" 2023-11-10 00:15:54 +13:00
buffile.h Change logtape/tuplestore code to use int64 for block numbers 2023-11-17 11:20:53 +09:00
bufmgr.h Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
bufpage.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
checksum.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
checksum_impl.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
condition_variable.h De-pessimize ConditionVariableCancelSleep(). 2023-08-15 10:23:47 +12:00
copydir.h Constify the arguments of copydir.h functions 2023-01-18 08:55:26 +09:00
dsm.h Avoid type cheats for invalid dsa_handles and dshash_table_handles. 2023-01-25 11:48:38 -05:00
dsm_impl.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
fd.h Make enum for sync methods available to frontend code. 2023-09-06 16:26:39 -07:00
fileset.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
freespace.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
fsm_internals.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
indexfsm.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ipc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
item.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
itemid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
itemptr.h Consolidate ItemPointer to Datum conversion functions 2023-02-13 09:57:15 +01:00
large_object.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
latch.h Use ResourceOwner to track WaitEventSets. 2023-11-23 13:31:36 +02:00
lmgr.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
lock.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
lockdefs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
lwlock.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
md.h Add smgrzeroextend(), FileZero(), FileFallocate() 2023-04-05 10:06:39 -07:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
off.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_sema.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_shmem.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
pmsignal.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
predicate.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
predicate_internals.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
proc.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
procarray.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
proclist.h Constify proclist.h 2023-01-19 09:45:34 +01:00
proclist_types.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
procsignal.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
reinit.h Refactor parse_filename_for_nontemp_relation to parse more. 2023-10-23 15:08:53 -04:00
relfilelocator.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
s_lock.h Fix some typos and some incorrectly duplicated words 2023-04-18 14:03:49 +12:00
sharedfileset.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
shm_mq.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
shm_toc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
shmem.h Remove SHM_QUEUE 2023-01-19 18:55:51 -08:00
sinval.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sinvaladt.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
smgr.h Remove bogus #include added by d4e71df6d7. 2023-04-26 10:43:53 +12:00
spin.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
standby.h Remove vacuum_defer_cleanup_age 2023-04-24 12:21:02 -07:00
standbydefs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sync.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00