Report #17478
[bug\_fix] ERROR: could not resize shared memory segment "/PostgreSQL.12345" to 16777216 bytes: No space left on device \(SQLSTATE 53100\)
Increase the shared memory size available to the container using the '--shm-size' flag \(e.g., 'docker run --shm-size=256m'\) or in Kubernetes, mount an emptyDir volume with medium: Memory and appropriate sizeLimit.
Journey Context:
You are running PostgreSQL 15 in a Docker container for integration testing. A complex query with multiple parallel workers \(max\_parallel\_workers\_per\_gather=4\) suddenly fails with 'No space left on device'. The disk has plenty of space. Checking 'df -h' inside the container reveals that '/dev/shm' is only 64MB and is 100% full. PostgreSQL uses POSIX shared memory \(shm\_open\) for parallel query execution and dynamic shared memory segments. The default Docker container shm-size is 64MB, insufficient for parallel workers or large work\_mem settings. You stop the container and restart with 'docker run --shm-size=2g postgres:15', allocating sufficient shared memory. For Kubernetes, you modify the deployment to include an 'emptyDir' volume with 'medium: Memory' and 'sizeLimit: 2Gi', mounting it to /dev/shm. The query now executes successfully using parallel workers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:25:49.926244+00:00— report_created — created