Skip to content

heap out of memory on version 5.1.3 #54701

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
Noysy opened this issue Jun 19, 2023 · 10 comments
Closed

heap out of memory on version 5.1.3 #54701

Noysy opened this issue Jun 19, 2023 · 10 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@Noysy
Copy link

Noysy commented Jun 19, 2023

Bug Report

🔎 Search Terms

  • Heap out of memory
  • TypeScript 5.1.3
  • TypeScript 5
  • v8::internal::DateCache::Weekday
  • v8::Isolate::ReportExternalAllocationLimitReached

🕗 Version & Regression Information

  • This on version 5.1.3 (works on versions 5.0.2 - 5.0.4, couldn't test on 5.1-beta and 5.1-rc)
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about heap out of memory
  • I was unable to test this on prior versions because npm i [email protected] doesn't work

⏯ Playground Link

Our codebase is huge and I was not able to find the source of the problem. I cannot link the repository as it is confidential, and therefore, private.

💻 Code

Again, unable to provide code because I did not manage to find the exact code that causes this issue. If you can provide some trace tools, that would be helpful.

🙁 Actual behavior

TypeScript compilation failed with the next error (from our CI when running tsc):

<--- Last few GCs --->

[1904:0x54fb0d0]   132902 ms: Mark-sweep (reduce) 2043.3 (2083.1) -> 2042.6 (2083.6) MB, 2407.8 / 0.0 ms  (average mu = 0.[17](github-repo-link)0, current mu = 0.030) allocation failure scavenge might not succeed
[[19](github-repo-link)04:0x54fb0d0]   135384 ms: Mark-sweep (reduce) [20](github-repo-link)43.6 (2083.6) -> 2043.1 (2084.1) MB, [22](github-repo-link)[28](github-repo-link).6 / 0.0 ms  (average mu = 0.138, 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: 0xb090e0 node::Abort() [node]
 2: 0xa1b70e  [node]
 3: 0xce19d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xce1d77 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xe993e5  [node]
 6: 0xea90ad v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xeabdae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xe6d022 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
 9: 0xe6793c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
10: 0xe67a15 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
11: 0x10d03de v8::internal::MaybeHandle<v8::internal::OrderedHashMap> v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate<v8::internal::Isolate>(v8::internal::Isolate*, int, v8::internal::AllocationType) [node]
12: 0x10d0493 v8::internal::MaybeHandle<v8::internal::OrderedHashMap> v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashMap>, int) [node]
13: 0x11dc5c5 v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [node]
14: 0x15d9e19  [node]

A similar error occurs when running tsc from a local machine:

<--- Last few GCs --->

[15456:0000024393635650]    71721 ms: Mark-sweep (reduce) 2044.1 (2083.6) -> 2043.6 (2083.8) MB, 764.1 / 0.0 ms  (average mu = 0.147, current mu = 0.049) allocation failure scavenge might not succeed
[15456:0000024393635650]    73048 ms: Mark-sweep (reduce) 2044.6 (2083.8) -> 2043.8 (2083.8) MB, 1303.3 / 0.0 ms  (average mu = 0.068, current mu = 0.018) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF69530151F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+121999
 2: 00007FF69528B386 DSA_meth_get_flags+64118
 3: 00007FF69528C402 DSA_meth_get_flags+68338
 4: 00007FF695BC2C94 v8::Isolate::ReportExternalAllocationLimitReached+116
 5: 00007FF695BAD25D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF695A5081C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF695A5D4C9 v8::internal::Heap::PublishPendingAllocations+1129
 8: 00007FF695A5A49A v8::internal::Heap::PageFlagsAreConsistent+2842
 9: 00007FF695A4D0F9 v8::internal::Heap::CollectGarbage+2137
10: 00007FF695A4B2B0 v8::internal::Heap::AllocateExternalBackingStore+2000
11: 00007FF695A6FE36 v8::internal::Factory::NewFillerObject+214
12: 00007FF6957A2545 v8::internal::DateCache::Weekday+1797
13: 00007FF695C50971 v8::internal::SetupIsolateDelegate::SetupHeap+494417
14: 0000024395A448ED 

🙂 Expected behavior

For TypeScript to compile without errors (it works just fine on v4. On v5 it's slower, but compiles without errors)

@haeferer
Copy link

haeferer commented Jun 20, 2023

can confirm ! Breaks on Windows and Unix.

@sashamorozov
Copy link

sashamorozov commented Jun 20, 2023

I confirm, I had to roll back to 5.0.4.

In my case, the error started appearing after updating fork-ts-checker-webpack-plugin to version 6.5.3 from 6.5.2

@meriturva
Copy link

Same here with version 5.1.3, with 5.0.4 everything is ok!

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Jun 22, 2023
@RyanCavanaugh
Copy link
Member

Sorry to hear you're encountering this. Unfortunately we can't really do much to investigate this without a way to repro the problem.

If someone can post a repro, we would be able to investigate this.

@PCOffline
Copy link

@RyanCavanaugh, can you provide some tools to help us trace the problems in our codebases? I face a similar issue; I get about the same obfuscated stack trace. If I can trace the origin of this issue, I'd share the relevant code.

@winterbe
Copy link

I'm encountering the same error when updating styled-components from version 5.3.9 to 6.0.0 using "@types/styled-components": "5.1.26". The out of memory error occurs both with typescript 5.0.3 and latest 5.1.5. I've tried to reproduce the issue in a fresh project by generating a bunch of React components that utilize Styled Components, but failed to reproduce.

@PCOffline
Copy link

5.1.5 seems to resolve the issue for me. Anyone else?

PJColombo added a commit to Blobscan/blobscan that referenced this issue Jul 19, 2023
- Rollback db-related command names: add `db:` prefix again
- Downgrade typescript version to 5.1.5 due to js heap out of memory error when running `tsc` (microsoft/TypeScript#54701)
PJColombo added a commit to Blobscan/blobscan that referenced this issue Jul 19, 2023
- Rollback db-related command names: add `db:` prefix again
- Downgrade typescript version to 5.1.5 due to js heap out of memory error when running `tsc` (microsoft/TypeScript#54701)
PJColombo added a commit to Blobscan/blobscan that referenced this issue Jul 19, 2023
- Rollback db-related command names: add `db:` prefix again
- Downgrade typescript version due to js heap out of memory error when running `tsc` (microsoft/TypeScript#54701)
@Sajarin-M
Copy link

I'm using TypeScript 5.1.6 and have the same problem. This problem started after I added some complicated Prisma types. However, when I removed those types, the problem was fixed.

> tsc --noEmit


<--- Last few GCs --->

[16154:0x613f590]   475890 ms: Mark-sweep (reduce) 2045.4 (2083.4) -> 2044.7 (2083.6) MB, 1797.5 / 0.0 ms  (average mu = 0.073, current mu = 0.013) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb7a940 node::Abort() [node]
 2: 0xa8e823  [node]
 3: 0xd5c940 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd5cce7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xf3a3e5  [node]
 6: 0xf3b2e8 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0xf4b7f3  [node]
 8: 0xf4c668 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xf26fce v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xf28397 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
11: 0xf0956a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
12: 0x12ce7af v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x16fb6b9  [node]
 ELIFECYCLE  Command failed.
[1]    16143 IOT instruction (core dumped)  pnpm lint

@schmod
Copy link

schmod commented Sep 1, 2023

Can confirm that 5.2.2 still has this issue for us, but 5.0.4 is fine.

Unfortunately, I cannot repro consistently.

@DanielRosenwasser
Copy link
Member

Are people still stuck on this? Is TS 5.3 or nightly working for anyone here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

10 participants