【问题标题】:NextJS - Too Many Open Files Error in ProductionNextJS - 生产中打开的文件过多错误
【发布时间】:2022-04-25 23:56:55
【问题描述】:

我的生产环境在交通高峰时段遇到了问题。任何有关确定此错误来源的帮助将不胜感激。

错误日志 -

[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']

我们使用getServerSideProps 进行服务器端渲染。

尝试围绕这个问题进行搜索,但大多数面临这个问题的人都在 NodeJS 中面临这个问题,所以不确定 NextJS 究竟是如何在幕后管理这个问题的。

生产环境- ECS Fargate(10GB RAM,4 个 vCPU)、Docker 容器、Node-12 Alpine、Next@10.2.2

【问题讨论】:

标签: node.js reactjs next.js server-side-rendering


【解决方案1】:

Fargate 默认将 nofile 资源限制覆盖为 1024。增加此值可以解决too many open files 问题。

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Ulimit.html

【讨论】:

  • 是的,这就是我最终解决问题的方法。非常感谢。
猜你喜欢
  • 1970-01-01
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多