Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when used in WorkerThread #123

Open
mika-fischer opened this issue Jan 20, 2022 · 0 comments
Open

Crash when used in WorkerThread #123

mika-fischer opened this issue Jan 20, 2022 · 0 comments

Comments

@mika-fischer
Copy link

Describe the bug
When used in a WorkerThread, native functions produce crashes.

To Reproduce

index.mjs:

import sspi from 'node-expose-sspi';
import { isMainThread, Worker } from 'worker_threads';

const name = isMainThread ? 'parent' : 'worker';

if (isMainThread) {
    const worker = new Worker('./index.mjs');
    worker.once('error', console.error);
    worker.once('exit', (code) => console.log(`Worker exited with code ${code}`));
}

while (true) {
    console.log(`${name} reachable: ${sspi.sso.isActiveDirectoryReachable()}`);
    await new Promise(resolve => setTimeout(resolve, 1000));
}

Trace

❯ node .\index.mjs
  node-expose-sspi:adConnection openADConnection: counter:  1 +0ms
  node-expose-sspi:adConnection closeADConnection: counter:  0 +6ms
parent reachable: false
2022-01-20T14:22:07.125Z node-expose-sspi:adConnection openADConnection: counter:  1
worker reachable: false
2022-01-20T14:22:07.133Z node-expose-sspi:adConnection closeADConnection: counter:  0
  node-expose-sspi:adConnection openADConnection: counter:  1 +1s
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
 1: 00007FF73B1A401F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112511
 2: 00007FF73B133146 DSA_meth_get_flags+65542
 3: 00007FF73B133FFD node::OnFatalError+301
 4: 00007FF73BA65A4C v8::FunctionTemplate::RemovePrototype+268
 5: 00007FF73B9326E6 v8::internal::HandleScope::Extend+54
 6: 00007FF73BA446D4 v8::EscapableHandleScope::EscapableHandleScope+52
 7: 00007FF73B179A48 napi_open_escapable_handle_scope+120
 8: 00007FF827743E3F
 9: 00007FF82773D218
10: 00007FF827772EE0
11: 00007FF827774C98
12: 00007FF73B172697 node::Stop+36391
13: 00007FF73BA20546 v8::internal::Builtins::code_handle+172694
14: 00007FF73BA20139 v8::internal::Builtins::code_handle+171657
15: 00007FF73BA203FC v8::internal::Builtins::code_handle+172364
16: 00007FF73BA20260 v8::internal::Builtins::code_handle+171952
17: 00007FF73BAF35B1 v8::internal::SetupIsolateDelegate::SetupHeap+494673
18: 00007FF73BA85A5E v8::internal::SetupIsolateDelegate::SetupHeap+45310
19: 00007FF73BA85A5E v8::internal::SetupIsolateDelegate::SetupHeap+45310
20: 00007FF73BAB5733 v8::internal::SetupIsolateDelegate::SetupHeap+241107
21: 00007FF73BB3BD42 v8::internal::SetupIsolateDelegate::SetupHeap+791522
22: 00007FF73BAA796A v8::internal::SetupIsolateDelegate::SetupHeap+184330
23: 00007FF73BA83B6B v8::internal::SetupIsolateDelegate::SetupHeap+37387
24: 00007FF73B9645DB v8::internal::Execution::CallWasm+1563
25: 00007FF73B9646FB v8::internal::Execution::CallWasm+1851
26: 00007FF73B9651AA v8::internal::Execution::TryCall+378
27: 00007FF73B94155A v8::internal::MicrotaskQueue::RunMicrotasks+410
28: 00007FF73B9412FA v8::internal::MicrotaskQueue::PerformCheckpointInternal+74
29: 00007FF73B1D2466 node::CallbackScope::~CallbackScope+710
30: 00007FF73B1D220E node::CallbackScope::~CallbackScope+110
31: 00007FF73B1A2CE9 v8::internal::CodeObjectRegistry::~CodeObjectRegistry+107593
32: 00007FF73B206354 uv_req_type_name+996
33: 00007FF73B202A62 uv_run+194
34: 00007FF73B1D1B75 node::SpinEventLoop+309
35: 00007FF73B0EBAC3 cppgc::internal::NormalPageSpace::linear_allocation_buffer+53827
36: 00007FF73B168E8D node::Start+221
37: 00007FF73AF888CC RC4_options+348108
38: 00007FF73BFE49F8 v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+14472
39: 00007FF83D8554E0 BaseThreadInitThunk+16
40: 00007FF83DDE485B RtlUserThreadStart+43

Expected behavior
It should not crash

Environment version:

  • OS: Windows 11 (also tested on Windows 10)
  • Node version and architecture: 16.13.2

Please indicates also:

  • Are you on a Windows domain ? no
  • Can you reach the domain controller ? no
  • Do your session have admin privileges ? no
  • Which authentication protocol ? none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant