cypress: cypress run occasionally crashes with node OOM errors

Current behavior:

<--- Last few GCs --->

[902:0x14d4055f4000]  1414367 ms: Mark-sweep 2050.4 (2142.6) -> 2050.4 (2142.6) MB, 2327.2 / 0.0 ms  allocation failure GC in old space requested
[902:0x14d4055f4000]  1416781 ms: Mark-sweep 2050.4 (2142.6) -> 2050.4 (2141.6) MB, 2414.3 / 0.0 ms  last resort 
[902:0x14d4055f4000]  1418947 ms: Mark-sweep 2050.4 (2141.6) -> 2050.4 (2141.6) MB, 2165.5 / 0.0 ms  last resort 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2fbf9512d681 <JSObject>
    2: stringSlice(aka stringSlice) [buffer.js:556] [bytecode=0x193b5ab7ca49 offset=96](this=0x10df42502311 <undefined>,buf=0x334eb421b249 <Uint8Array map = 0x2c7df00ceb21>,encoding=0x2fbf9513e8a9 <String[4]: utf8>,start=0,end=404259)
    4: toString [buffer.js:629] [bytecode=0x193b5ab7c681 offset=151](this=0x334eb421b249 <Uint8Array map = 0x2c7df00ceb21>,encoding=0x2fbf9513e8a9 <String[4]: utf8...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 2: 0x7faa08f32887 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 3: 0x7faa08aa1a57 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 4: 0x7faa08aa19d5 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 6: v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const>, v8::internal::PretenureFlag) [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 7: v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 8: node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*) [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
 9: 0x7faa08f4e5d8 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
10: 0x7faa08a71550 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
11: 0x7faa088dfd98 [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
12: 0x7faa088df30e [/root/.cache/Cypress/3.0.1/Cypress/libnode.so]
13: 0x67697b843fd

Desired behavior:

No crash

Steps to reproduce:

circleci 2.0 config chrome67-ff65 docker img cypress-typescript-preprocessor 100 spec files

Versions

Cypress 3.0.1 Running chrome67-ff65 docker image on CircleCI 2.0 Ubuntu 16.04

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I’ve run now into the same issue - Cypress 3.1.0, Mac OS X 10.13.6, Electron 59 The issue occurs while running a suite which contains of two tests. In the second test on the same request it fails with

<— Last few GCs —>

[83531:0x7fe0d680bc00]    57174 ms: Mark-sweep 2046.6 (2157.3) -> 2046.6 (2157.8) MB, 159.9 / 0.5 ms  allocation failure GC in old space requested
[83531:0x7fe0d680bc00]    57398 ms: Mark-sweep 2046.6 (2157.8) -> 2046.6 (2123.8) MB, 223.6 / 34.7 ms  last resort 
[83531:0x7fe0d680bc00]    57604 ms: Mark-sweep 2046.6 (2123.8) -> 2046.6 (2122.3) MB, 205.4 / 33.0 ms  last resort 

<— JS stacktrace —>

==== JS stack trace =========================================

Security context: 0x2628cba4b5d1 <Window map = 0x2fd68238cd89>
    2: replace(this=0x170eef7dd8e9 <Very long string[857083]>,0x3e6fee24e431 <JSRegExp <String[23]: url\((['"])([^'"]*)\1\)>>,0x170eef7dd971 <JSFunction (sfi = 0x48f53597449)>)
    3: makePathsAbsoluteToStylesheet [http://localhost:4444/__cypress/runner/cypress_runner.js:~61447] [pc=0x2e42e426b914](this=0x2d94465b28c9 <JSGlobal Object>,styles=0x170eef7dd8e9 <Very long string[8...

Memory statements from CYPRESS_MEMORY=1 did not show a significant increase and as well no direct shortage of memory

memory info { rss: 238333952,
  heapTotal: 129863680,
  heapUsed: 116772008,
  external: 676034 }
memory info { rss: 232624128,
  heapTotal: 126193664,
  heapUsed: 114479928,
  external: 438446 }
memory info { rss: 232689664,
  heapTotal: 126193664,
  heapUsed: 114558776,
  external: 439619 }

The third info was taken after the last request was send - and directly after that the GC statement showed up.

After setting video:false in the configuration there was no change to the behavior. Same for the configuration option numTestsKeptInMemory a reduction from the default value to e.g. did not provided a different result.

We’re not running typescript - plain javascript tests.

Since you’re using typescript too, it might be the same issue as https://github.com/cypress-io/cypress/issues/2316

Here is my solution, after spending quite a while on this:

  • Use Chrome 97, I did this through cypress/included:9.5.1 docker image

I was previously failing with the memory issue when using cypress/included:12.1.0

@asafbenm Check this link: https://github.com/cypress-io/cypress/issues/2316 Scroll down, there is a code example, which I have used exactly as it posted but without “fork-ts-checker” plugin

We made several performance improvements in our latest updates, particularly version 3.3.2, can we get an update on whether this issue is still occurring in our latest version? Thanks!