Container killed with exit code 137: OOM or SIGKILL?
THE SHORT ANSWER
Exit code 137 is 128 + 9: the process was killed with SIGKILL. In a container that usually means it went over its memory limit and the kernel's OOM killer stopped it, but docker kill and a docker stop that ran out of patience give 137 too. Check with docker inspect: State.OOMKilled is true only for a memory kill. Then make the app fit: cap Node's heap below the container limit with --max-old-space-size, run fewer Python workers or recycle them with max_requests, stream large data instead of loading it, and give the build its own memory budget, separate from the running app.
What does exit code 137 mean?
When a process dies from a signal, the shell reports 128 plus the signal number. Bash's manual: “Bash uses the value 128+N as the exit status.” SIGKILL is signal 9, so 128 + 9 = 137. SIGKILL can't be caught or handled, which is why the app logs nothing before it dies. You may see only Killed, or nothing at all.
Three things send SIGKILL to a container:
| Cause | Exit code | OOMKilled |
|---|---|---|
Over the --memory limit, kernel OOM killer | 137 | true |
docker kill | 137 | false |
docker stop when the app ignores SIGTERM for 10 seconds | 137 | false |
Those are real results from Docker 29 with node:22-alpine. A slow shutdown on every deploy is the usual case of the third row: docker stop sends SIGTERM, waits (10 seconds on Linux by default), then sends SIGKILL. Handle SIGTERM and exit, and those 137s stop.
How do you tell an OOM kill from a manual kill?
Ask Docker:
$ docker inspect my-app --format 'ExitCode={{.State.ExitCode}} OOMKilled={{.State.OOMKilled}}'
ExitCode=137 OOMKilled=trueTwo catches. First, the flag describes the last exit only: a container with a restart policy starts again and you may read the new state. Second, the exit code can mislead when the killed process isn't the container's main process. The same memory hog run under npm start gave this:
npm error command failed npm error signal SIGKILL $ docker inspect ... ExitCode=1 OOMKilled=true
npm survived and exited with 1, so there's no 137 anywhere, yet it was a memory kill. Docker's event stream records every OOM kill in the container, whichever process it hit, so it's the more reliable check:
$ docker events --since 1h --until 0s --filter event=oom \
--format '{{.Time}} {{.Action}} {{.Actor.Attributes.name}}'
1795539974 oom my-appNode.js: --max-old-space-size vs the container limit
There are two limits, and they fail differently. V8's heap limit is inside Node: hitting it prints FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory, and OOMKilled stays false. The container's --memory limit is the kernel's: hitting it is a silent SIGKILL and exit 137.
You want V8 to hit its own limit first, because it garbage-collects hard as it gets close. So set the heap below the container limit, leaving room for everything outside the heap: code, buffers, native modules like sharp. Node's docs suggest 1536 MiB on a 2 GiB machine.
# 512 MB container NODE_OPTIONS=--max-old-space-size=384 node server.js # or in package.json "start": "node --max-old-space-size=384 server.js"
Buffers, image processing and native addons live outside the heap, so a small heap limit doesn't stop them. If the app is killed while the heap is small, look for large files read into memory, image resizing, or a cache with no size limit.
Don't carry a build-sized heap into the runtime. An NODE_OPTIONS value set for next build applies to the server too; the heap error during builds is covered in JavaScript heap out of memory during next build.
Python: workers that get killed
A Python app usually keeps running when it hits the limit, because the kernel kills one worker, not the master. Gunicorn logs it like this, starts a new worker, and the request that was in flight gets no response:
[ERROR] Worker (pid:12) was sent SIGKILL! Perhaps out of memory? [INFO] Booting worker with pid: 13
Memory is per worker, so the total is workers times the size of one. Gunicorn's default is 1 worker; many configs set 4 or more, which on a small container is often the whole problem. In order of effort:
- Run fewer workers (
--workers 2), and use threads if you need more concurrency. - Recycle workers that grow slowly:
--max-requests 1000 --max-requests-jitter 100. The defaultmax_requestsis 0, which never restarts them. - Process large files and query results in chunks instead of reading them whole.
Is it the build or the running app?
Read where the 137 appears:
- In the build log, during
npm run build,pip installor a compile step: the build machine ran out. The app never started. Bundlers, TypeScript and native compiles often need more memory than the finished app. - After a successful deploy, in runtime logs or as restarts: the running app went over its limit. That depends on traffic, so it can take hours to show up.
They have different fixes. A build needs a bigger build machine or a lighter build (no source maps, type checking in CI). The running app needs a lower memory footprint or a bigger plan. Raising one does nothing for the other.
What happens on EthioDeploy?
Each app container has a hard memory limit set by your plan:
| Container | Free | Pro | Business |
|---|---|---|---|
| App | 256 MB | 1 GB | 2 GB |
| Postgres | 256 MB | 512 MB | 1 GB |
| MySQL | 512 MB | 768 MB | 1 GB |
| Redis | 128 MB | 128 MB | 128 MB |
When an app goes over, the kernel kills it and it restarts on its own. The project overview then shows a warning card, “Out of memory: stopped N times in the last 7 days”, with the newest kills listed by what was killed (the app, a branch deployment, or a database), the limit it hit and when. It also catches the case above where a child process was killed and the container exited 0 or 1, because it's built on Docker's oom events, not the exit code. For the app, the card says requests in flight during the restart fail, and lists common causes, such as resizing images on the server with Next.js next/image.
On the Free plan, the app container also gets --max-old-space-size=160 in NODE_OPTIONS, so Node collects garbage before it reaches the 256 MB limit. The deploy log says:
Capping the Node.js heap at 160MB of this container's 256MB (NODE_OPTIONS), so Node collects garbage before the memory limit is hit. Set your own --max-old-space-size in NODE_OPTIONS, or ETHIODEPLOY_NODE_HEAP=off, to change this.
Your own --max-old-space-size wins. Pro and Business don't get the cap, because Node already sizes its heap well below a 1 GB or 2 GB limit.
Builds run in a separate, memory-capped builder, not in your app's container, so the plan limits above don't apply to them, and a build that runs out of memory isn't counted on the overview card. It fails the deploy with the error in the build log, and the previous version keeps serving. Plan limits are on the pricing page.
Questions
The container's main process was killed with SIGKILL: 128 plus signal 9. Most often the container went over its memory limit and the kernel's OOM killer stopped it, but docker kill and a docker stop that timed out also give 137.
Run docker inspect --format '{{.State.OOMKilled}}' on the container. true means a memory kill. Because a restart resets that state and a killed child process may not give exit 137, docker events --filter event=oom is the more reliable record.
No. The heap error comes from Node when V8 reaches --max-old-space-size, and Node prints FATAL ERROR before exiting. Exit 137 comes from the kernel when the whole container passes its memory limit, with no message from Node. Set the heap limit below the container limit so you get the first one.
Gunicorn logs "Worker was sent SIGKILL! Perhaps out of memory?" when the kernel kills a worker, usually because workers times per-worker memory is over the container limit. Run fewer workers, recycle them with --max-requests, or process data in chunks.
Not necessarily. Builds often use more memory than the running app. Fix the build by lightening it or giving the build machine more memory, and size the app's runtime limit separately.
Sources
Checked on November 24, 2026:
Push a repo. Get a URL.
Start freeJoin the EthioDeploy Telegram
Release notes as they ship, plus deploy help from the team and other developers.