'NextJS - Too Many Open Files Error in Production
I'm facing an issue in my Production environment during peak traffic hours. Any help on identifying the source of this error would be really appreciated.
Error logs -
[Error: EMFILE: too many open files, open '/app/.next/static/chunks/48573ff84b35da845925e086d08de2d8e5ac654c.49c46a48c467dff66cb4.js']
[Error: EMFILE: too many open files, open '/app/.next/static/chunks/8f319b75d6c4fca96c1042484fc0ad01e1047720.aa22673b9cc07604ffb2.js']
We're using getServerSideProps
for server-side rendering.
Tried searching around this issue but most of the people facing this are facing this in NodeJS so not sure exactly how NextJS is managing this behind the scenes.
Production environment - ECS Fargate (10GB RAM, 4 vCPU), Docker Container, Node-12 Alpine, [email protected]
Solution 1:[1]
Fargate overrides nofile
resource limit to 1024 by default. Increasing this value could solve too many open files
problem.
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Ulimit.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |