Diagnostic Queries
Symptoms
The server could not create the semaphores it needs at startup because the kernel ran out of semaphore space. PostgreSQL raises SQLSTATE 53200 (out_of_memory).
- Semaphore allocation failed at startup.
- Common with kernel SEMMNS/SEMMNI limits too low.
- Note: this is not a disk-space issue despite the wording.
What the server log shows
FATAL: could not create semaphores: No space left on device
DETAIL: Failed system call was semget(5432001, 17, 03600).
Why PostgreSQL raises this — what the manual says
Section 18.4.1 Shared Memory and Semaphores:
“The maximum number of semaphores in the system is set by SEMMNS, which consequently must be at least as high as num_os_semaphores plus one extra for each set of 16 required semaphores (see the formula in Table 18.1).”
PostgreSQL allocates semaphore sets sized by max_connections and related settings. When the kernel’s semaphore limits are exhausted, semget() fails (misleadingly “No space left on device”) and the server reports 53200.
Common causes
- Kernel semaphore limits (SEMMNS/SEMMNI) too low.
- Other processes consuming the available semaphore sets.
max_connectionsset very high.
How to fix it
- Raise kernel semaphore limits per the OS tuning guide.
- Lower
max_connectionsif appropriate. - Free leaked IPC resources from crashed processes (ipcs/ipcrm).
Related & next steps
Reference: PostgreSQL 18 Section 19.4 “Managing Kernel Resources”.
Thanks — noted. This helps keep the database accurate.