pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix io_uring resource leaks across crash restarts 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix io_uring resource leaks across crash restarts @ 2026-11-05 09:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-11-05 09:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@draescher.fr> Author: Lucas DRAESCHER <git@draescher.fr> Reviewed-by: ChangAo Chen <cca5507@qq.com> Reviewed-by: Ilmar Yunusov <tanswis42@gmail.com> Reviewed-by: Laetitia Avrot <laetitia.avrot@gmail.com> Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/zHN8Rb7syWYDBPUhCICxKLr_tQmFLg0T024irxVVb6RSSicZcqcA0eT73z2PQy7JmzzqnUzX0Hi3P2dP... Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/953c6dabdb52663a6b96ad354b33496284d8ed73 Modified Files -------------- src/backend/storage/aio/method_io_uring.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix io_uring resource leaks across crash restarts @ 2026-11-05 09:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-11-05 09:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@draescher.fr> Author: Lucas DRAESCHER <git@draescher.fr> Reviewed-by: ChangAo Chen <cca5507@qq.com> Reviewed-by: Ilmar Yunusov <tanswis42@gmail.com> Reviewed-by: Laetitia Avrot <laetitia.avrot@gmail.com> Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/zHN8Rb7syWYDBPUhCICxKLr_tQmFLg0T024irxVVb6RSSicZcqcA0eT73z2PQy7JmzzqnUzX0Hi3P2dP... Backpatch-through: 18 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/62f868e779b3b41945fba27f65dec33595b97fd0 Modified Files -------------- src/backend/storage/aio/method_io_uring.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix io_uring resource leaks across crash restarts @ 2026-11-05 09:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-11-05 09:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@draescher.fr> Author: Lucas DRAESCHER <git@draescher.fr> Reviewed-by: ChangAo Chen <cca5507@qq.com> Reviewed-by: Ilmar Yunusov <tanswis42@gmail.com> Reviewed-by: Laetitia Avrot <laetitia.avrot@gmail.com> Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/zHN8Rb7syWYDBPUhCICxKLr_tQmFLg0T024irxVVb6RSSicZcqcA0eT73z2PQy7JmzzqnUzX0Hi3P2dP... 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(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-11-05 09:04 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-05 09:04 pgsql: Fix io_uring resource leaks across crash restarts Fujii Masao <fujii@postgresql.org> 2026-11-05 09:04 pgsql: Fix io_uring resource leaks across crash restarts Fujii Masao <fujii@postgresql.org> 2026-11-05 09:04 pgsql: Fix io_uring resource leaks across crash restarts Fujii Masao <fujii@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox