When I'm building my Angular-CLI project on Bamboo I'm getting the following error:
Error: EMFILE: too many open files, open '<file...>'
EMFILE: too many open files, open '<file...>'
I'm running elastic Bamboo on AWS EC2 linux instances. I've looked at Atlassian's support forum but they only gave general guidelines to solve the problem not how to actually add the fix to an existing bamboo setup that uses AWS EC2 instances.
In your Angular CLI project, under your .angular-cli.json
(cli v1.x.x) or angular.json
(cli v6.x.x+) under assets
you've probably added a folder that contains a lot of files. When angular cli builds the project, the files are copied over to the build folder which is the main culprit for the error since the process hit the limit to the amount of files that can opened and copied over at the system level.
To solve this you'll just need to update your AWS EC2 image config in the bamboo admin menu to include the fix described in the support forum.
Overview
ELASTIC BAMBOO
, click Image configurations
edit
for that particular configuration row.Instance startup script
text-fieldAdd the following lines to the bottom of the script list
#increase open file limit
sudo echo "* soft nofile 40000" >> /etc/security/limits.conf
sudo echo "* hard nofile 40000" >> /etc/security/limits.conf
Please note *
is to indicate any user but to be more specific you can replace it with Bamboo_USER
Click Save
ELASTIC BAMBOO
, click Instances
Terminate all instances
to remove any instances with the old script, please make sure you're not building anything at the time of termination as the builds will be interrupted and fail.