playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Heap OOM when combining `repeatEach` with `on-first-retry` and `retain-on-first-failure` trace configs

Open ronanshel opened this issue 7 months ago • 1 comments

Version

1.50.1

Steps to reproduce

On a large test suite with many failing tests, config:

  • repeatEach = 3
  • retries = 2
  • trace config to either on-first-retry or retain-on-first-failure.

In these configs, after the tests complete, before the reporters complete, I encounter the below OOM.

Interestingly, setting the trace config to retain-on-failure solves it for me. Unfortunately, that leaves me with way too many unnecessary trace files.

Expected behavior

I would expect "on first failure" and "on first retry" to be the less memory intensive options...

Actual behavior

yet somehow they cause the heap OOM exception, while "retain on failure" doesn't.

Additional context

playwright-playwright-1  \| <--- Last few GCs --->
--
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| [72353:0x6f9b5b0]   880315 ms: Mark-Compact 4040.3 (4128.3) -> 4024.5 (4128.3) MB, 2180.50 / 0.00 ms  (average mu = 0.144, current mu = 0.010) allocation failure; scavenge might not succeed
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| [72353:0x6f9b5b0]   882475 ms: Mark-Compact 4041.0 (4128.8) -> 4024.6 (4128.8) MB, 2132.53 / 0.00 ms  (average mu = 0.083, current mu = 0.013) allocation failure; scavenge might not succeed
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| <--- JS stacktrace --->
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| ----- Native stack trace -----
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  1: 0xb82c78 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  2: 0xeefa80 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  3: 0xeefd67 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  4: 0x1101905  [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  5: 0x1101e94 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  6: 0x1118d84 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  7: 0x111959c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  8: 0x10ef8a1 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \|  9: 0x10f0a35 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| 10: 0x10ce086 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| 11: 0x1529eb6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
  | 2025-06-10 11:31:07 PDT | playwright-playwright-1  \| 12: 0x7f658ea99ef6

Environment

System:
    OS: macOS 15.5
    Memory: 20.06 MB / 32.00 GB
(also reproduces on Linux)
  Binaries:
    Node: 20.14.0
    Yarn: 1.22.22
    npm: 10.7.0
  Languages:
    Bash: 5.2.37

ronanshel avatar Jun 11 '25 18:06 ronanshel

@ronanshel We would love to fix this issue. However, we need the exact steps to reproduce the problem, including your app, tests, config and the exact way you invoke the test runner. See this guide for helpful tips.

dgozman avatar Jun 12 '25 08:06 dgozman

Closing as per above - feel free to re-file with more details.

mxschmitt avatar Jun 18 '25 12:06 mxschmitt