EPGStation icon indicating copy to clipboard operation
EPGStation copied to clipboard

npm run build がswapを十分に用意してもheap limitしてしまう

Open T-SUGIUE opened this issue 5 months ago • 1 comments

環境

  • Version of EPGStation: v2.7.3
  • Version of Mirakurun: 3.9.0-rc.4
  • Version of Node: v18.19.0
  • Version of NPM: 10.2.3
  • OS: Ubuntu 20.04.6 LTS
  • Architecture: arm64(sunxi64)
  • Hardware: Orange Pi PC2

Issue

下記の通りビルドしようとしたところ Reached heap limit Allocation failed - JavaScript heap out of memoryでビルド失敗してしまいます。 swapは拡張していて、node の heap についても最大サイズを指定はしています。 OSについては amrbian 23.2 でも Ubuntu 20.04 LTSでも同じ挙動をしていることを確認済みです。 回避策等ありますでしょうか?

root@orangepipc2:~/EPGStation# echo $NODE_OPTIONS
 --max-old-space-size=2048
root@orangepipc2:~/EPGStation# free -h
              total        used        free      shared  buff/cache   available
Mem:          987Mi       238Mi       624Mi       0.0Ki       125Mi       674Mi
Swap:         2.0Gi       118Mi       1.9Gi

root@orangepipc2:~/EPGStation# sysctl -a | grep swappiness
vm.swappiness = 100
root@orangepipc2:~/EPGStation# npm run build

> [email protected] build
> npm run build-server && npm run build-client

> [email protected] build-server
> npm run lint && npm run format && npm run compile

> [email protected] lint
> eslint --fix --ext .ts src/

> [email protected] format
> prettier --check --write 'src/**/*.ts'

Checking formatting...
All matched files use Prettier code style!

> [email protected] compile
> tsc

> [email protected] build-client
> cd client && npm run build

> [email protected] build
> NODE_OPTIONS='--openssl-legacy-provider' vue-cli-service build

?  Building for production...Starting type checking service...
Using 1 worker with 2048MB memory limit
?  Building for production...Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
?  Building for production...
<--- Last few GCs --->

[9023:0xfa95870]   342694 ms: Scavenge 481.9 (500.2) -> 481.8 (501.0) MB, 20.1 / 0.0 ms  (average mu = 0.415, current mu = 0.224) allocation failure;
[9023:0xfa95870]   342738 ms: Scavenge 482.8 (501.0) -> 482.7 (505.7) MB, 31.3 / 0.0 ms  (average mu = 0.415, current mu = 0.224) allocation failure;
[9023:0xfa95870]   345193 ms: Mark-sweep 488.5 (508.7) -> 486.0 (510.2) MB, 2409.6 / 0.0 ms  (average mu = 0.266, current mu = 0.060) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb7f974 node::Abort() [node]
 2: 0xa97f08  [node]
 3: 0xd40e78 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd41048 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xf1f5fc  [node]
 6: 0xf31594 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xf0d718 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xf0e6f0 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0xef1380 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x1297a34 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x167c4ec  [node]
Aborted

T-SUGIUE avatar Feb 04 '24 05:02 T-SUGIUE