Skip to content

fix: default Postgres to io_method=worker instead of io_uring#6630

Merged
otavio merged 1 commit into
masterfrom
fix/postgres-io-uring-default
Jul 10, 2026
Merged

fix: default Postgres to io_method=worker instead of io_uring#6630
otavio merged 1 commit into
masterfrom
fix/postgres-io-uring-default

Conversation

@otavio

@otavio otavio commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

We ship the Postgres service with io_method=io_uring forced on, plus seccomp=unconfined to allow the io_uring syscalls. On some hosts Postgres fails to start with:

could not setup io_uring queue: Cannot allocate memory

This ENOMEM from io_uring_setup is not a lack of RAM. The io_uring rings count against the container's RLIMIT_MEMLOCK, and some kernels ship with io_uring disabled via sysctl (kernel.io_uring_disabled=2, now a default on several hardened distros). Either condition makes the syscall fail regardless of how much memory the box has. io_uring is a fragile default for a self-hosted product that runs on arbitrary kernels and container runtimes.

Changes

Switch the default to Postgres 18's own default io_method=worker (asynchronous I/O via worker processes, no io_uring syscalls) in both docker-compose.postgres.yml and docker-compose.postgres.test.yml. This also removes the need for the security_opt: seccomp=unconfined override, a security downgrade carried only to enable io_uring. The performance difference from io_uring is marginal for our workload and does not justify the support burden.

Related

Fixes #6629
Reported by a self-hoster upgrading to v0.26.0 (#6627).

io_uring forces seccomp=unconfined and fails on hardened kernels
(kernel.io_uring_disabled=2) or when RLIMIT_MEMLOCK is low, surfacing
as "could not setup io_uring queue: Cannot allocate memory" regardless
of available RAM. Switch both compose files to Postgres 18's default
io_method=worker, which needs no io_uring syscalls, and drop the
seccomp=unconfined security downgrade carried only to enable io_uring.

Fixes: #6629
@otavio otavio requested a review from a team as a code owner July 10, 2026 15:09
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Claude finished @otavio's task in 54s —— View job


Code Review Complete

Reviewed 2 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is.

A few confirming notes on the change:

  • io_method=worker is a valid value for Postgres 18 and is in fact PG18's built-in default, so the flag is now effectively explicit-documentation of the default behavior — safe.
  • Removing security_opt: seccomp=unconfined is a net security improvement: it restores Docker's default seccomp profile, and it was only ever added to permit the io_uring syscalls.
  • Both docker-compose.postgres.yml and docker-compose.postgres.test.yml are updated consistently, and no dangling io_uring/seccomp references remain elsewhere in the repo.

To request another review round, comment /review.

@otavio otavio requested a review from gustavosbarreto July 10, 2026 15:10
@otavio otavio merged commit a735215 into master Jul 10, 2026
14 checks passed
@otavio otavio deleted the fix/postgres-io-uring-default branch July 10, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgres fails to start with io_uring on some hosts (Cannot allocate memory)

1 participant