Node container on Fargate is killed with signal SIGKILL
error Command failed with signal "SIGKILL".Short answer
SIGKILL means something killed the process from outside. On ECS that is usually the container using more memory than the task definition gives it. Read the stopped task's reason, then raise the task memory or fix a container-level memory limit that is lower than you think.
Fix it fast
1Find out which cause you have
Open the stopped task and read its stop reason. An OutOfMemoryError category points at the causes below.
grep -n "memory" taskdef.json2Match what you see, then jump to its fix
What does the error look like?
error Command failed with signal "SIGKILL".
Cause 1 of 2
The container uses more memory than the task has
1Check
ECS says this happens when processes in the container use more memory than the task definition allocated, or hit host constraints.
grep -n -E "\"(cpu|memory)\"" taskdef.json2Fix
Register a new revision with more task memory, and update the service.
"cpu": "1024",
"memory": "4096"3Verify
The new task stays RUNNING through the step that was killed.
grep -n "memory" taskdef.jsonConfirmed by docs.aws.amazon.com
Cause 2 of 2
A container-level hard limit is below the task memory
1Check
memory in a container definition is the hard limit. memoryReservation is only a soft limit, and when both are set memory must be the greater.
grep -n -E "memory(Reservation)?" taskdef.json2Fix
Raise or remove the container's hard memory value so it matches what the process needs.
"memory": 3072,
"memoryReservation": 10243Verify
Run the task again and watch that container.
grep -n -E "memory(Reservation)?" taskdef.jsonConfirmed by docs.aws.amazon.com
How do I stop it coming back?
- Watch memory use of the service so you raise limits before a kill.
- Keep memory and memoryReservation in the task definition under version control, with memory the larger.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix