Skip to content

Regression in 5.1: OOM during build (while using discord.js) #54494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mysak0CZ opened this issue Jun 2, 2023 · 1 comment
Closed

Regression in 5.1: OOM during build (while using discord.js) #54494

Mysak0CZ opened this issue Jun 2, 2023 · 1 comment

Comments

@Mysak0CZ
Copy link

Mysak0CZ commented Jun 2, 2023

Bug Report

🔎 Search Terms

discord.js, 5.1.3, OOM, JavaScript heap out of memory

🕗 Version & Regression Information

  • This is a OOM crash
  • This changed between versions 5.0.4 and 5.1.3 (narrowed down to between 5.1.0-dev.20230502 and 5.1.0-dev.20230506)
  • Issue is still present as of 5.2.0-dev.20230602

⏯ Playground Link

Minimal reproduction repo available here (I don't know TS enough to investigate which part of discord.js is causing this):
https://github.com/Mysak0CZ/ts-5.1-discord.js-regression

I tried multiple TS versions, results can be seen as CI of individual branches:
https://github.com/Mysak0CZ/ts-5.1-discord.js-regression/branches/all

💻 Code

// Simply doing this makes TSC crash on OOM
import 'discord.js';

🙁 Actual behavior

$ tsc -p ./tsconfig.json

<--- Last few GCs --->

[48523:0x561d6b25b7d0]    14584 ms: Scavenge 4038.7 (4125.9) -> 4037.2 (4126.9) MB, 9.4 / 0.0 ms  (average mu = 0.810, current mu = 0.756) allocation failure; 
[48523:0x561d6b25b7d0]    14608 ms: Scavenge 4039.8 (4126.9) -> 4037.9 (4138.2) MB, 23.7 / 0.0 ms  (average mu = 0.810, current mu = 0.756) allocation failure; 
[48523:0x561d6b25b7d0]    15469 ms: Mark-sweep 4051.4 (4138.2) -> 4048.1 (4151.7) MB, 857.4 / 0.0 ms  (average mu = 0.645, current mu = 0.102) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x561d67bf8c35 node::Abort() [/usr/bin/node]
 2: 0x561d67a87666 node::OOMErrorHandler(char const*, bool) [/usr/bin/node]
 3: 0x561d67df2454 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0x561d67df284b v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0x561d67fb877a  [/usr/bin/node]
 6: 0x561d67fd07a9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 7: 0x561d67fab5d7 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 8: 0x561d67fac969 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 9: 0x561d67f90b36 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
10: 0x561d683245c9 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
11: 0x561d68725af9  [/usr/bin/node]

🙂 Expected behavior

Code should compile without errors.

Additional notes

  • I tried with up to NODE_OPTIONS=--max-old-space-size=14336 without success - crash still occurs. I don't have enough RAM to try higher than that.
  • On problematic versions tsc never finishes, so I have no output from tsc --noEmit --diagnostics --extendedDiagnostics --incremental false to share.
@Mysak0CZ
Copy link
Author

Mysak0CZ commented Jun 2, 2023

Friend investigated closer and it appears this has same root cause as described in:
#54491 (comment)

So closing this as it appears to be a duplicate.

@Mysak0CZ Mysak0CZ closed this as completed Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant