node-ffi-napi: Intermittent crash saying "Check failed: result.second"

When I upgraded to node v14, I started getting intermittent crashes when trying to load a library (see below). The code that causes the crash looks like this. (I say looks like this because the names have been changed and also it’s intermittent.)

var ffi = require('ffi-napi');
var ref = require('ref-napi');
var voidPtr = ref.refType(ref.types.void);
var g = ffi.Library('mylib64', {
	'new_object': [voidPtr, []],
});

It doesn’t seem to actually matter what specific functions I put in the list — sometimes it crashes, sometimes not — but the more functions, the more certain the crash (maybe because there’s a higher chance of causing the issue?), and there needs to be at least 1 function in my tests.

It looks related to #71 and nodejs/node#32463 , but not sure. Have tried v14.3 v14.11 and v14.12, and all are the same. No issues on v13.14.0.

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0000005E6BFFD540
 1: 00007FF6FC04E94F v8::internal::wasm::DisjointAllocationPool::~DisjointAllocationPool+74447
 2: 00007FF6FBF889BF std::basic_ostream<char,std::char_traits<char> >::operator<<+55551
 3: 00007FF6FCB570D2 V8_Fatal+162
 4: 00007FF6FC6191CD v8::internal::BackingStore::Reallocate+653
 5: 00007FF6FC844929 v8::ArrayBuffer::GetBackingStore+137
 6: 00007FF6FC0319D9 napi_get_typedarray_info+393
 7: 00007FF8D1B77AC1
 8: 00007FF8D1B774DC
 9: 00007FF8D1B7C220
10: 00007FF8D1B7846E
11: 00007FF8D1B77827
12: 00007FF8D1B7CCF3
13: 00007FF6FC02C4C6 node::Stop+29366
14: 00007FF6FC807C5F v8::internal::Builtins::builtin_handle+330191
15: 00007FF6FC8071EE v8::internal::Builtins::builtin_handle+327518
16: 00007FF6FC8074E7 v8::internal::Builtins::builtin_handle+328279
17: 00007FF6FC807333 v8::internal::Builtins::builtin_handle+327843
18: 00007FF6FC8E538D v8::internal::SetupIsolateDelegate::SetupHeap+466093
19: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
20: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
21: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
22: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
23: 00007FF6FC8770C9 v8::internal::SetupIsolateDelegate::SetupHeap+14825
24: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
25: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
26: 00007FF6FC8F7C66 v8::internal::SetupIsolateDelegate::SetupHeap+542086
27: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
28: 00007FF6FC8770C9 v8::internal::SetupIsolateDelegate::SetupHeap+14825
29: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
30: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
31: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
32: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
33: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
34: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
35: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
36: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
37: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
38: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
39: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
40: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
41: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
42: 00007FF6FC87D528 v8::internal::SetupIsolateDelegate::SetupHeap+40520
43: 00007FF6FC87B10E v8::internal::SetupIsolateDelegate::SetupHeap+31278
44: 00007FF6FC87ACFC v8::internal::SetupIsolateDelegate::SetupHeap+30236
45: 00007FF6FC75EC0F v8::internal::Execution::CallWasm+1743
46: 00007FF6FC75E41F v8::internal::Execution::Call+191
47: 00007FF6FC837FC7 v8::Function::Call+615
48: 00007FF6FC020ECF napi_unref_threadsafe_function+2911
49: 00007FF6FC024AD7 node::Start+1143
50: 00007FF6FC024ED1 node::Start+2161
51: 00007FF6FC06DF58 node::LoadEnvironment+56
52: 00007FF6FBFB0C33 EVP_CIPHER_CTX_buf_noconst+39971
53: 00007FF6FC024780 node::Start+288
54: 00007FF6FBE866FC RC4_options+339452
55: 00007FF6FCDA04CC v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+156812
56: 00007FF91CC67BD4 BaseThreadInitThunk+20
57: 00007FF91DFCCE51 RtlUserThreadStart+33
Segmentation fault

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 3
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I too have noticed an increase in crashes. Not certain that it’s the same issue as yours as I got no output on crash (only Segmentation Fault).

I’m downgrading now to v13 to see if the problem ceases.

On Linux (debian, x64)

EDIT: can confirm return of stability after downgrade.