XRAY: How to fix Xray error: ”could not resize shared memory segment… No space left on device” (SQLSTATE 53100)

XRAY: How to fix Xray error: ”could not resize shared memory segment… No space left on device” (SQLSTATE 53100)

Products
JFrog_Xray
Content Type
Installation_Setup
AuthorFullName__c
Jian Sun
articleNumber
000006804
FirstPublishedDate
2025-12-30T14:52:35Z
lastModifiedDate
2025-12-30
Introduction 

When your Xray is in following scenario:
  1. Xray report generation (large reports / heavy vulnerability queries)  and
  2. PostgreSQL running in Docker/Kubernetes where /dev/shm is small
When generating an Xray report, the process will fail and Xray logs will show:
Failed to produce report (id 60) ... Error fetching public vulnerabilities ...
Caused by: ERROR: could not resize shared memory segment "/PostgreSQL.819717120" to 8388608 bytes: No space left on device (SQLSTATE 53100)

Cause

PostgreSQL needs shared memory (typically backed by /dev/shm) for certain operations (e.g., query execution, sorting/hash operations). If the shared memory segment cannot grow because the backing space is exhausted, PostgreSQL throws SQLSTATE 53100.

This is commonly seen when PostgreSQL runs in a Docker container with the default shared memory size (often 64MB), which may be insufficient for large Xray report workloads.


Resolution

1. Increase container shared memory (/dev/shm)
If PostgreSQL is running as a Docker container, start it with a larger --shm-size, for example:
docker run ... --shm-size=1g ...
Recommended: at least 512MB, often 1GB+ for large reports.

2. Verify /dev/shm usage
Inside the PostgreSQL container:
df -h | grep shm
If usage is near 100%, increase --shm-size.

3. Restart the PostgreSQL container (if needed)
A restart can release shared memory usage and re-create segments, but it is not a permanent fix unless /dev/shm is increased.