testing-library / testing-library/user-event

JavaScript heap out of memory

Open
#1,286 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs assessment
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

My project was working fine 13 months ago (2024-04-24), but at some point the tests started failing. I've been trying to figure out what is wrong, but when I call user.type(), the test hangs for several minutes until it runs out of memory, like it's stuck in an infinite loop.

I've tried a multitude of different versions, upgrading and downgrading the various testing-library dependencies, but it continues to fail every single time.

<--- Last few GCs --->
[3104:0x22afb200]   195238 ms: Mark-Compact 4039.3 (4129.7) -> 4023.8 (4130.2) MB, 3306.25 / 0.00 ms  (average mu = 0.132, current mu = 0.023) allocation failure; scavenge might not succeed
[3104:0x22afb200]   197835 ms: Mark-Compact 4039.7 (4130.2) -> 4024.3 (4130.7) MB, 2561.44 / 0.00 ms  (average mu = 0.079, current mu = 0.014) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
 1: 0xb8cf03 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/node]
 2: 0xf04140 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]
 3: 0xf04427 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]
 4: 0x1116075  [/usr/local/bin/node]
 5: 0x1116604 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
 6: 0x112d4f4 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/usr/local/bin/node]
 7: 0x112dd0c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 8: 0x1104011 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 9: 0x11051a5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10e27f6 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
11: 0x153e336 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x7fba06e99ef6 
Aborted (core dumped)
error Command failed with exit code 134.

The package.json from my current attempt looks like:
https://github.com/aio-libs/aiohttp-admin/blob/9e03deb885ebf7a097aea41113891df195ea93e7/admin-js/package.json

And the test run:
https://github.com/aio-libs/aiohttp-admin/actions/runs/15261816820/job/42920980207?pr=933

The actual test it's running is:
https://github.com/aio-libs/aiohttp-admin/blob/9e03deb885ebf7a097aea41113891df195ea93e7/admin-js/tests/simple.test.js#L66-L73

If I remove the user.type() line, then there's no error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing admin-js/package.json and tests/simple.test.js at lines 66-73, then run the linked GitHub Actions test to reproduce the heap exhaustion around user.type(). Done means the test completes without hanging or exhausting the JavaScript heap.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.