| From: | surya poondla <suryapoondla4(at)gmail(dot)com> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>, "Si, Evan" <evsi(at)amazon(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work |
| Date: | 2026-01-15 20:27:23 |
| Message-ID: | CAOVWO5q5hoQvLM_xY-yGDyn7kv-s8Dg7uTcTfqqqPHVjFYKJ1Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
>
> 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
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Document-correct-kernel-requirements-for-io_uring.patch | application/octet-stream | 7.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-01-16 06:23:26 | Re: BUG #19355: Attempt to insert data unexpectedly during concurrent update |
| Previous Message | Dean Rasheed | 2026-01-15 16:34:51 | Re: BUG #19355: Attempt to insert data unexpectedly during concurrent update |