gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

1.0.0-alpha.2 JavaScript heap out of memory #896

Open jimmont opened 6 years ago

jimmont commented 6 years ago

reverting to 0.4.5 fixed the following issue in that it doesn't exhaust the heap or masks this and exits. if I find more details plan to share them here. it's unclear what in our independent project (not istanbul) is the source of the problem.

uname -a
Darwin  17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
node -v
v8.11.4
npm -v
6.4.0
"istanbul": "^1.0.0-alpha.2",

problem:
<--- Last few GCs --->

[25457:0x102806a00]   971082 ms: Mark-sweep 1330.4 (1480.9) -> 1330.0 (1488.4) MB, 1026.0 / 0.0 ms  allocation failure GC in old space requested
[25457:0x102806a00]   972117 ms: Mark-sweep 1330.0 (1488.4) -> 1330.0 (1449.9) MB, 1034.5 / 0.0 ms  last resort GC in old space requested
[25457:0x102806a00]   973220 ms: Mark-sweep 1330.0 (1449.9) -> 1330.0 (1446.9) MB, 1103.2 / 0.0 ms  last resort GC in old space requested

<--- JS stacktrace --->

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

Security context: 0x14707e725879 <JSObject>
    1: update [crypto.js:~97] [pc=0x901d8ee9223](this=0x1470eacfd829 <Hash map = 0x14701ab7cac1>,data=0x14703b7385b9 <Very long string[3617303]>,encoding=0x1470341022d1 <undefined>)
    2: arguments adaptor frame: 1->2
    3: exit [/projects/node_modules/istanbul-lib-instrument/dist/visitor.js:575] [bytecode=0x1470070690e1 offset=202](this=0x1470989840f9 <Object map ...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/.nvm/versions/node/v8.11.4/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/.nvm/versions/node/v8.11.4/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/.nvm/versions/node/v8.11.4/bin/node]
 4: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/.nvm/versions/node/v8.11.4/bin/node]
 5: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/.nvm/versions/node/v8.11.4/bin/node]
 6: v8::String::WriteUtf8(char*, int, int*, int) const [/.nvm/versions/node/v8.11.4/bin/node]
 7: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [/.nvm/versions/node/v8.11.4/bin/node]
 8: node::crypto::Hash::HashUpdate(v8::FunctionCallbackInfo<v8::Value> const&) [/.nvm/versions/node/v8.11.4/bin/node]
 9: 0x901d8cd0f67
10: 0x901d8ee9223