【问题标题】:Reached heap limit Allocation failed - JavaScript heap out of memory on EB / AL2达到堆限制分配失败 - EB / AL2 上的 JavaScript 堆内存不足
【发布时间】:2023-01-13 02:48:53
【问题描述】:

我有一个在 AL2 Elastic Beanstalk - t2.micro 上运行的 node.js 应用程序。当我从我的 ios 应用程序中删除多个文档时,服务器通常会停止响应近 10 分钟。这是日志:

Nov 22 06:24:54 ip-172-31-46-248 web: <--- Last few GCs --->
Nov 22 06:24:54 ip-172-31-46-248 web: [32206:0x5803f50]  5317454 ms: Mark-sweep (reduce) 489.0 (500.6) -> 488.4 (500.8) MB, 1003.0 / 0.0 ms  (average mu = 0.209, current mu = 0.153) allocation failure scavenge might not succeed
Nov 22 06:24:54 ip-172-31-46-248 web: [32206:0x5803f50]  5318798 ms: Mark-sweep (reduce) 489.6 (500.8) -> 488.9 (501.1) MB, 1162.6 / 0.0 ms  (average mu = 0.170, current mu = 0.135) allocation failure scavenge might not succeed
Nov 22 06:24:54 ip-172-31-46-248 web: <--- JS stacktrace --->
Nov 22 06:24:54 ip-172-31-46-248 web: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Nov 22 06:24:54 ip-172-31-46-248 web: 1: 0xb06730 node::Abort() [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 2: 0xa1b6d0  [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 3: 0xce1dd0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 4: 0xce2177 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 5: 0xe997e5  [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 6: 0xea94ad v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 7: 0xeac1ae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 8: 0xe6d6ea v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 9: 0x11e6456 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
Nov 22 06:24:54 ip-172-31-46-248 web: 10: 0x15da0d9  [node]
Nov 22 06:24:55 ip-172-31-46-248 web: > start
Nov 22 06:24:55 ip-172-31-46-248 web: > node app.js

我该如何解决这个问题?

【问题讨论】:

    标签: node.js express amazon-ec2 server amazon-elastic-beanstalk


    【解决方案1】:

    您可能需要更大的 EC2 实例来运行您的代码。正如您在错误消息中看到的那样,问题是您的服务器内存不足。因此,选择小型或中型实例可能会解决您的内存问题。或者,如果您的代码无法正常工作,它也可能是个问题。

    【讨论】:

      猜你喜欢
      • 2022-01-24
      • 2020-03-20
      • 2020-06-25
      • 2021-05-06
      • 2018-12-05
      • 2019-05-05
      • 2022-10-06
      • 2018-09-29
      • 1970-01-01
      相关资源
      最近更新 更多