Vscode-jest: Listen for Jest crashing, and restart the watcher

Created on 3 Oct 2017  路  5Comments  路  Source: jest-community/vscode-jest

Environment

  1. node -v: 8.4
  2. Operating system: macOS

Steps to Reproduce

Run Jest for a very long time. Get output like:

[83639:0x103000000]  2640294 ms: Mark-sweep 1403.7 (1559.1) -> 1403.7 (1559.1) MB, 1658.3 / 0.0 ms  allocation failure GC in old space requested
[83639:0x103000000]  2642200 ms: Mark-sweep 1403.7 (1559.1) -> 1403.7 (1542.1) MB, 1905.3 / 0.0 ms  last resort 
[83639:0x103000000]  2644065 ms: Mark-sweep 1403.7 (1542.1) -> 1403.7 (1541.1) MB, 1863.2 / 0.0 ms  last resort
<--- JS stacktrace --->

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

Security context: 0x3c40f489cef1 <JSObject>
    2: stringSlice(aka stringSlice) [buffer.js:556] [bytecode=0x247d9e747009 offset=96](this=0x3c40f4882241 <undefined>,buf=0x173c99209f01 <Uint8Array map = 0x358156c43de1>,encoding=0x3c40f48fe879 <String[4]: utf8>,start=0,end=298264)
    4: toString [buffer.js:629] [bytecode=0x247d9e746c41 offset=148](this=0x173c99209f01 <Uint8Array map = 0x358156c43de1>,encoding=0x3c40f48fe879 <String[4]: utf8...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

 1: 
node::Abort() [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 2: 
node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 3: 
v8::internal::V8::FatalProcessOutOfMemory(char const*, bool)
 [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 4: 
v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 5: 
v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const>, v8::internal::PretenureFlag)
 [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 6: 
v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 7: 
node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*)
 [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]


 8: 
void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&)
 [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
 9: 
v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]

10: 
v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]

11: 
v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]

12: 0x23c1f6a840dd

Closed Jest
Closed Jest

Expected Behavior

Restart the watcher, and continue, show a message that Jest crashed and was re-booted so that people are not confused.

Actual Behavior

The spinner indicating it is working continues to spin.

All 5 comments

I was wondering if we should do something in the onExit callback when the watcher exit unexpectedly... if node did get to notify us that is... we can test it by manually killing the jest watch and see if it trigger the onExit... I will take a look

Related: #49

there is one concern... if for some reason jest couldn't be started, we will be firing it up continuously in that case... eventually killed vscode... maybe we should have a max restart count to safeguard this issue... thoughts?

I had the same concern. I think that would be a simple solution for now. Just have maybe max retries of 3.

Fixed and shipped 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DaniGTA picture DaniGTA  路  3Comments

somewhatabstract picture somewhatabstract  路  4Comments

ryanlittle picture ryanlittle  路  3Comments

jpokrzyk picture jpokrzyk  路  5Comments

skippednote picture skippednote  路  3Comments