Exit Code 137 means that the process was terminated by the SIGKILL (9) signal. In most cases, this is done by the OOM Killer mechanism when the system runs out of RAM.
Main Causes
- Insufficient RAM
- Exceeding memory limit in the Docker container
- Memory leak in the application
- Strict cgroup limits
Method 1: Check OOM Killer
Check the system log:
dmesg | grep -i kill
If there is a mention of Out of memory in the output, the process was terminated due to lack of RAM.
Method 2: Increase Memory Limit (Docker)
If the error occurs in a container:
docker run -m 2g your_image
Or in docker-compose:
deploy:
resources:
limits:
memory: 2g
Method 3: Add Swap
Check the current swap:
free -h
If swap is absent, create it:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Method 4: Optimize Application
- Reduce memory consumption
- Check for memory leaks
- Configure JVM/Node.js limits if necessary
Conclusion
Exit Code 137 is almost always related to insufficient memory. Checking logs, increasing Docker limits, and configuring swap help resolve the issue.