0

I am running into the open files limit for the webapp user for a server process (that spawns goroutines) on AWS Elastic Beanstalk.

On my local environment, with an open FD limit of 8k, I'm able to handle this quite fine, but I'm unable to increase the limit for the webapp EC2 user on AWS Elastic Beanstalk.

As per the instructions for Golang development on AWS Elastic Beanstalk, I have a procfile for the web process, that looks like :

web: bin/server.sh

and server.sh being:

#!/bin/bash

ulimit -n 32768
./bin/server
exit 0

And I get the error in the stdout logs :

web: bin/server.sh: line 3: ulimit: open files: cannot modify limit: Operation not permitted

I have been able to increase the hard/soft limits for the instance as such by doing this earlier in the deployment process, using a file in the .ebextensions folder, as shown in this example here: https://github.com/awsdocs/elastic-beanstalk-samples/blob/main/configuration-files/aws-provided/instance-configuration/java-increase-file-descriptors.config but this does not have any effect on my applicaton process started by the webapp user.

Thanks in advance.

EDIT: I realize that my final question is not obvious. Since it appears that the webapp user does not have permissions to change such limits, how do I achieve this change on Elastic Beanstalk?

hans0l074
  • 73
  • 6
  • 1
    You get this error, because `webapp` has no permissions to change it. Your `bin/server.sh` executes probably under `webapp` user. – Marcin Aug 22 '20 at 13:34

1 Answers1

0

I was able to solve this problem by following the concept presented here

So my server.sh looks like:

#!/bin/bash

ulimit -Sn unlimited
./bin/server
exit 0

And now, my web process does not have any issues with too many open files.

hans0l074
  • 73
  • 6