When I run the build <redacted> it fails with
Memory usage in bytes:
138018816
#10 1691.2 Killed
#10 ERROR: process "/bin/sh -c npm install && BUILD_NUMBER=\"${BUILD_NUMBER}\" npm --report-on-fatalerror --report-on-signal --max-old-space-size=2048 run build-prod" did not complete successfully: exit code: 137
------
> [build-nodejs 4/4] RUN npm install && BUILD_NUMBER="267" npm --report-on-fatalerror --report-on-signal --max-old-space-size=2048 run build-prod:
------
process "/bin/sh -c npm install && BUILD_NUMBER=\"${BUILD_NUMBER}\" npm --report-on-fatalerror --report-on-signal --max-old-space-size=2048 run build-prod" did not complete successfully: exit code: 137
task: Failed to run task "build": exit status 1
I have the memory use logs on. That doesn't seem to kill it. It is getting lower and still fine.
Memory usage in bytes:
138735616
Wed Mar 6 08:50:25 UTC 2024
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2892 972 ? Ss 08:21 0:00 /bin/sh -c exit $( (/usr/bin/mkfifo /opt/atlassian/pipelines/agent/tmp/build_result && /bin/cat /opt/atlassian/pipelines/agent/tmp/build_result) || /bin/echo 1)
root 7 0.0 0.0 2892 108 ? S 08:21 0:00 /bin/sh -c exit $( (/usr/bin/mkfifo /opt/atlassian/pipelines/agent/tmp/build_result && /bin/cat /opt/atlassian/pipelines/agent/tmp/build_result) || /bin/echo 1)
root 8 0.0 0.0 3216 1016 ? S 08:21 0:00 /bin/cat /opt/atlassian/pipelines/agent/tmp/build_result
root 10 0.0 0.0 2892 976 ? Ss 08:21 0:00 /bin/sh /opt/atlassian/pipelines/agent/tmp/wrapperScript3458278447178824736.sh
root 39 0.0 0.0 2892 952 ? S 08:21 0:00 /bin/sh /opt/atlassian/pipelines/agent/tmp/buildScript11719303506556174579.sh
root 40 0.0 0.0 8872 7552 ? S 08:21 0:00 /bin/bash -i /opt/atlassian/pipelines/agent/tmp/bashScript17359917558946570271.sh
root 177 0.0 0.0 8872 5976 ? S 08:21 0:00 /bin/bash -i /opt/atlassian/pipelines/agent/tmp/bashScript17359917558946570271.sh
root 178 0.0 0.0 8872 5976 ? S 08:21 0:00 /bin/bash -i /opt/atlassian/pipelines/agent/tmp/bashScript17359917558946570271.sh
root 181 0.0 0.0 1233440 8940 ? Sl 08:21 0:00 task build -- GEN-114_backpack_storage-2024.03.06.0267
root 190 0.3 0.1 755392 37000 ? Sl 08:21 0:06 docker build --pull -t <redacted> --build-arg BACKPACK_USER=$BACKPACK_USER --build-arg BACKPACK_PASSWORD=$BACKPACK_PASSWORD --build-arg ENV=prod --build-arg BUILD_NUMBER=267 .
root 4458 0.0 0.0 3212 988 ? S 08:50 0:00 sleep 2
root 4460 0.0 0.0 7484 3372 ? R 08:50 0:00 ps aux
So my guess is something related to docker daemon. But how do I check that?
Works fine on my local system.
Hello @Iwan van Staveren and welcome to the Community!
The exit code 137 returned by npm command usually indicates a memory allocation issue, where npm is exceeding the current available memory in the environment.
Looking at the logs you shared with us, it seems like you are executing the npm command as part of a docker build (the npm command is inside a Dockerfile). Could you confirm if that is the case?
If yes, then I would suggest increasing the memory allocated to the docker service and verifying if it solves the issue. By default, the docker service in pipelines is allocated with 1GB of memory, out of the 4GB available for the step (8GB for size:2x steps)
You can increase the memory allocated for docker service up to 3GB for normal steps, and 7GB for size: 2x steps.
For that, you'd need to add a definition to your bitbucket-pipelines.yml file configuring the amount of memory you want. Following is an example of configuring the docker service to use 2GB of memory :
definitions:
services:
docker:
memory: 2048 # increase the memory for docker service from 1GB to 2GB
You can start testing with 2GB, and then tweak that value according to the amount of memory used by your build and the commands you are executing in your pipeline.
For more details on how memory allocation works in pipelines, the following article may also be of help :
Hope that helps! Should you have any questions, feel free to ask.
Thank you, @Iwan van Staveren !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.