| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix io_uring resource leaks across crash restarts |
| Date: | 2026-11-05 09:04:58 |
| Message-ID: | E1xOtP0-00000000Huo-3Hgn@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix io_uring resource leaks across crash restarts
With io_method=io_uring and restart_after_crash enabled, the postmaster
reinitializes shared memory after a backend crash. It created new
io_uring instances without releasing its references to the old ones,
causing resources to accumulate on each crash restart. Eventually,
creating new instances could fail with "Too many open files" or
"Cannot allocate memory", preventing the server from restarting.
Fix this by registering an on_shmem_exit() callback to release the
postmaster's references to the io_uring instances during shared
memory cleanup, before creating new ones. This prevents resources
from accumulating across crash restarts.
Backpatch to v18, where io_method=io_uring was introduced.
Reported-by: Lucas DRAESCHER <git(at)draescher(dot)fr>
Author: Lucas DRAESCHER <git(at)draescher(dot)fr>
Reviewed-by: ChangAo Chen <cca5507(at)qq(dot)com>
Reviewed-by: Ilmar Yunusov <tanswis42(at)gmail(dot)com>
Reviewed-by: Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
Reviewed-by: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Discussion: https://postgr.es/m/zHN8Rb7syWYDBPUhCICxKLr_tQmFLg0T024irxVVb6RSSicZcqcA0eT73z2PQy7JmzzqnUzX0Hi3P2dPKRvmNx_jbAqSCLyqJvWjXEypyAI=@draescher.fr
Backpatch-through: 18
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5bfe88cf6a814e24ac9c7332142a75d11a2e5461
Modified Files
--------------
src/backend/storage/aio/method_io_uring.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-11-05 09:08:30 | pgsql: Fix stale visibility maps in incremental backups after heap trun |
| Previous Message | Fujii Masao | 2026-11-05 09:04:46 | pgsql: Fix io_uring resource leaks across crash restarts |