Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring - Mailing list pgsql-hackers

From Lætitia AVROT
Subject Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring
Date
Msg-id 178067263688.594055.1686317716173563895.pgcf@coridan.postgresql.org
Whole thread
In response to Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring  (Laetitia Avrot <laetitia.avrot@gmail.com>)
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       not tested
Spec compliant:           not tested
Documentation:            not tested

Hi Lucas,
I reviewed v3 on Debian, kernel 6.17.13, liburing 2.14.
I reproduced the bug on unpatched master: fd count doubles from 142 to 284 after killing a backend. With the patch
applied,the count stays stable. The fix works.
 
Build was clean, no new warnings. All 245 regression tests pass, make check-world passes, and all 39 TAP tests pass.
The code is clean and follows PostgreSQL conventions. The null guard before registering the callback is correct, the
wrappersatisfies the on_shmem_exit() signature, and setting pgaio_uring_contexts to NULL after cleanup prevents a
double-free.
One note for the committer: on_shmem_exit() callbacks fire in LIFO order, so this callback runs before anything
registeredearlier in AioShmemInit(), which is the safe direction. Worth confirming that no earlier-registered callback
couldinvalidate pgaio_uring_contexts before this one runs.
 
On the v1 vs v2 design question: I favour v2. The Table AM precedent suggests PostgreSQL prefers clean interface
boundarieseven with a single implementor, and Andres Freund has been explicit about this in the past.
 
Marking as Ready for Committer.
Regards,
Lætitia

pgsql-hackers by date:

Previous
From: Laetitia Avrot
Date:
Subject: Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring
Next
From: Jacob Champion
Date:
Subject: Re: Prevent remote libpq notices from being sent to clients