playwright: [BUG] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
System info
- Playwright Version: “@playwright/experimental-ct-react17”: “^1.33.0”
- Operating System: Windows 11
- Browser: All
- Other info: I am using Experimental: components
Source code
- I provided exact source code that allows reproducing the issue locally.
Link to the GitHub repository with the repro
https://github.com/flora8984461/reproduce-jest-failure/tree/reproduce-playwright-out-of-memory
Steps
- clone the repo, checkout branch: reproduce-playwright-out-of-memory, and run
yarnand thenyarn test-ct.
Expected
Run the test properly.
Or provide any configs to allow the test run properly.
Actual It crashes during bundle phase with the following error:
✓ 1505 modules transformed.
<--- Last few GCs --->
[8908:00000215E683B3A0] 61960 ms: Mark-sweep 4039.1 (4138.8) -> 4036.2 (4138.8) MB, 2008.2 / 0.0 ms (average mu = 0.560, current mu = 0.050) allocation failure scavenge might not succeed
[8908:00000215E683B3A0] 65264 ms: Mark-sweep 4051.9 (4138.8) -> 4049.5 (4165.3) MB, 3295.0 / 0.0 ms (average mu = 0.303, current mu = 0.003) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF614B10AAF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+124015
2: 00007FF614A9C866 v8::internal::wasm::WasmCode::safepoint_table_offset+64182
3: 00007FF614A9D8E2 v8::internal::wasm::WasmCode::safepoint_table_offset+68402
4: 00007FF6153D1CE4 v8::Isolate::ReportExternalAllocationLimitReached+116
5: 00007FF6153BC2AD v8::SharedArrayBuffer::Externalize+781
6: 00007FF61525F88C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
7: 00007FF61525C9A4 v8::internal::Heap::CollectGarbage+4244
8: 00007FF61525A320 v8::internal::Heap::AllocateExternalBackingStore+2000
9: 00007FF61527EEA6 v8::internal::Factory::NewFillerObject+214
10: 00007FF614FB1645 v8::internal::DateCache::Weekday+1797
11: 00007FF61545F9C1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
12: 00000215E89B71FA
error Command failed with exit code 134.
Notes There is some open issue in vite and fluentui:
- https://github.com/microsoft/fluentui/issues/25547
- https://github.com/microsoft/fluentui/issues/24952
- https://github.com/vitejs/vite/issues/2433
It happens when I add @fluentui/react-icons. After taking a look at the open issue, seems I can skip bundle for @fluentui/react-icons. I am not sure if there is an option to set playwright to do that when it bundles.
I am looking for any suggestions to workaround it. Your help is really appreciated 🙏
I notice there are some similar issues but they got closed without any solutions.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 2
- Comments: 16 (2 by maintainers)
The sampe problem for me. I played with different configurations and found, that it stops working correctly from version 1.40 of Playwright. In Task Explorer I see, that memory for Node JS process is growing constantly (such as CPU), and when process is taking a bit more than 4Gb, it aborted. Logs look like:
Stacktrace:
Env:
OS: Windows 11 / Debian 12.5 Browser: Chrome Playwright: >= 1.40
In case it helps in the interim, I’ve changed the
test-ctscript to increase the memory allocation for node:NODE_OPTIONS=--max-old-space-size=8192 playwright test -c playwright-ct.config.ts. There might be a better solution than that. Our company project tests some large sections of UI with component tests, and we’ve had to bump the memory from the beginning.I’m curious if the playwright team has suggestions / guidance on “how much UI is too much to component test”, or at what point a JS bundle passed around in node could be problematic for performance. I’m guessing overall the component tests are pretty memory intensive given how the JS bundle is served from node => browser. In our case, the main JS bundle is 8.8MB (1.7MB gzipped).
I have been using playwright
1.39.0along with pytest and python. Considering the NODE OPTIONS is out of scope in python, what are the alternatives?I can keep it open to see if others comment on the issue. It works for me with the default options, no NODE_OPTIONS required.