| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | Dat Tran <trduydat(at)gmail(dot)com> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: PostgreSQL 17.11: SIGSEGV in dsa_free after "could not resize shared memory segment ... No space left on device" |
| Date: | 2026-11-27 09:40:27 |
| Message-ID: | CALdSSPjxjmJ4eb+F1QUfDyBuW15U4EB4exq8ra5YXNaYxF0FHA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Fri, 27 Nov 2026 at 13:36, Dat Tran <trduydat(at)gmail(dot)com> wrote:
>
> 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.
isnt this already fixed by
https://github.com/postgres/postgres/commit/6a806d254f30b8ac8feceb933063db00669a3510
?
--
Best regards,
Kirill Reshke
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2026-11-27 09:51:37 | Re: BUG #19942: SIGSEGV crash (and wrong results) in MERGE ... RETURNING WITH (OLD/NEW) with VIRTUAL generated colum |
| Previous Message | Alexander Lakhin | 2026-11-27 09:00:00 | Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance |