Sure Andres, I am working on a patch which emits a useful error message too.
Hi All,
I prepared a patch that implements an early detection of unsupported io_uring operations during PostgreSQL startup, before any I/O is attempted. The patch focuses on
1. Clear error message at startup instead of cryptic EINVAL during queries.
2. Immediate failure with actionable hints (upgrade kernel or use io_method=worker)
3. Prevents PostgreSQL from starting in a broken state
Before the patch:
1. PostgreSQL started successfully
2. Connection attempts failed with EINVAL errors
After patch:
1. PostgreSQL refuses to start
2. Clear error message that looks like:
"FATAL: kernel does not support required io_uring operations"
"DETAIL: The kernel supports io_uring but lacks one or more of the required opcodes (IORING_OP_READ, IORING_OP_WRITE, IORING_OP_READV, IORING_OP_WRITEV). This typically occurs on Linux kernels older than 5.6."
"HINT: Either upgrade your kernel to version 5.6 or newer, or
use io_method=worker"
Modified files in the Patch:
1. configure.ac: Added io_uring_opcode_supported to AC_CHECK_FUNCS
2. meson.build: Added corresponding function check for Meson build
3. src/backend/storage/aio/method_io_uring.c: Added is_uring_read_write_unsupported() function, that is integrated into pgaio_uring_init() and reports clear error with details and hints.
I tested the patch on Ubuntu server with Linux kernel 5.4.0-216-generic, and when io_uring is enabled I see that postgres doesn’t start (expected behavior).
The existing error handling for kernels < 5.1 (ENOSYS) is preserved.
Regards,
Surya Poondla