AnOldSoul
AnOldSoul

Reputation: 4207

Service running in ECS container throws java.io.IOException: Too many open files

I have a service that runs in an ECS container that is throwing the below shown exception.

java.io.IOException: Too many open files

I believe the default ulimit setting of 1024 is quite low and could increase the soft limit and hard limit. However I'm trying to understand what these open files are or why I'm getting this now. Would appreciate any feedback/guidance on going about figuring out why I'm getting this error.

Upvotes: 1

Views: 1213

Answers (1)

Preetham
Preetham

Reputation: 11

In linux TCP/IP connections are considered as open files ( refer to this for more info ). If your service takes too long to respond to requests and there are too many requests in a short span, this could cause the too many open files issue. There are two possible workarounds.

  1. Investigate why the service takes too long to respond? ( maybe some unoptimized DB calls )
  2. Increase the open file limit - tread cautiously - not sure what happens if you set this value too large. increase-set-open-file-limits-in-fargate-cf

Upvotes: 1

Related Questions