| From: | Dat Tran <trduydat(at)gmail(dot)com> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | PostgreSQL 17.11: SIGSEGV in dsa_free after "could not resize shared memory segment ... No space left on device" |
| Date: | 2026-11-27 04:36:44 |
| Message-ID: | CA+USo9pd2ZvHQQaVxH_XbEQmZJdFbuwZs9w=X4zJc9dEBp4LPw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello,
PostgreSQL version: 17.11 (official Docker image postgres:17.11-alpine,
x86_64)
Setting: dynamic_shared_memory_type=posix (default), /dev/shm limited
(Kubernetes default 64 MiB; reproduced locally with --shm-size 8m)
Summary
When /dev/shm fills up, a backend logs
could not resize shared memory segment "/PostgreSQL.N" to 33554432 bytes:
No space left on device
and shortly afterwards a backend, or the autovacuum launcher, dies with
SIGSEGV. The kernel log shows a NULL+0x18 read:
postgres[N]: segfault at 18 ip ... error 4 in postgres[...]
which resolves to dsa_free+0xde in the image's binary. The postmaster then
restarts all backends ("the database system is in recovery mode").
Expected
The out-of-space error is reported to the session, without leaving the DSA
area in a state where a later dsa_free crashes the server.
How it happened
A test suite runs many concurrent sessions that each CREATE DATABASE ...
TEMPLATE, run tests, and DROP DATABASE ... WITH (FORCE). Each database has
a few hundred tables. With many databases alive at once, the shared
statistics (stored in DSM) grow until /dev/shm is full.
Reproduction
1. docker run --shm-size 8m -e POSTGRES_PASSWORD=x postgres:17.11-alpine
2. From several (6 or more) concurrent clients, repeatedly create a
database with a few hundred tables, use it, and drop it WITH (FORCE).
3. Within minutes: "No space left on device" resize errors, then SIGSEGV at
dsa_free and crash recovery.
In our local run: 3 segfaults, 9 "No space left on device" errors and 106
recovery-mode messages with posix DSM; with
dynamic_shared_memory_type=mmap, the same workload ran with none.
Workaround
dynamic_shared_memory_type=mmap, or a larger /dev/shm.
Thank you.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | ZizhuanLiu X-MAN | 2026-11-27 05:17:48 | Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs |
| Previous Message | Raja Sai pranav | 2026-11-26 21:23:22 | Re: BUG #19890: pg_receivewal advances past a truncated LZ4 WAL segment |