mocha-parallel-tests icon indicating copy to clipboard operation
mocha-parallel-tests copied to clipboard

Using worker threads causes some native modules to crash

Open asztal opened this issue 5 years ago • 3 comments

Is there a way to disable the node v12 behaviour where mocha-parallel-tests uses worker threads?

As great as it sounds, it's causing an issue with some native modules which are not context-aware and crash when loaded in a worker thread, for example node-sass: https://github.com/sass/node-sass/issues/2746

If I were to contribute such an option, how would you want it to be done (--some-option, environment variable, something else)?

asztal avatar Sep 25 '19 15:09 asztal

Interesting. My preference would be having an environment variable because it's more like an emergency measure rather than an intended behaviour change based on the flag. Happy to review the PR.

1999 avatar Sep 26 '19 04:09 1999

Created a pull request for this issue

slava-t avatar Mar 18 '20 15:03 slava-t

I am wondering if I might be hitting something similar with the grpc native modules:

FATAL ERROR: HandleScope::HandleScope Entering the V8 API without proper locking in place
 1: 0x9dab80 node::Abort() [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 2: 0x9dbd36 node::OnFatalError(char const*, char const*) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 3: 0xb3b22a v8::Utils::ReportApiFailure(char const*, char const*) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 4: 0xb3c7ae v8::HandleScope::HandleScope(v8::Isolate*) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 5: 0x94a98e node::InternalCallbackScope::InternalCallbackScope(node::Environment*, v8::Local<v8::Object>, node::async_context const&, node::InternalCallbackScope::ResourceExpectation) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 6: 0x94b8a5 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
 7: 0x7fc130c89abc  [/home/silas/code/platform/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node]
 8: 0x7fc130c94193  [/home/silas/code/platform/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node]
 9: 0x12df7ec  [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
10: 0x12d856c uv_run [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
11: 0xa1d120 node::NodeMainInstance::Run() [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
12: 0x9acb78 node::Start(int, char**) [/home/silas/.nvm/versions/node/v12.15.0/bin/node]
13: 0x7fc139b0a023 __libc_start_main [/usr/lib/libc.so.6]
14: 0x94a115  [/home/silas/.nvm/versions/node/v12.15.0/bin/node]

silasdavis avatar Apr 24 '20 16:04 silasdavis