I am trying to connect to a synced realm with node.js from macOS 12.0.1 or macOS 11.6.2 but get a segmentation fault on macOS 12.0.1 and a libc++abi Abort trap: 6 on macOS 11.6.2.
We have also tried js DSK 10.6.0 and 10.8.0 but they all crash will similar issues.
Node versions are 16.13.0 on macOS 12.0.1 and 12.20.2 on macOS 11.6.2.
Can someone confirm what versions of Node.js are supported by the realm-js SDK and that this should work.
Thanks, we’re rather stuck on this.
Connecting to the MongoDB Realm App seems to work fine and we can see the log in connections in the Realm App console.
Hi @Duncan_Groenewald
Can you please post the code snippet that leads the app to the crash?
See more details here
opened 11:12PM - 30 Nov 21 UTC
closed 01:32PM - 20 Dec 21 UTC
T-Bug
O-Community
### How frequently does the bug occur?
All the time
### Description
Try… ing to load an existing local realm file into a test MongoDB Realm App and using a node.js script to do so. However when calling realm.open() we are getting a segmentation fault.
Node v16.13.0
realm-js v10.10.1
log in appears to work fine but the subsequent call results in a segmentation fault.
```
const realmConfig = {
schema: target_realm_schema,
sync: {
user: app.currentUser,
partitionValue: partitionKey,
// The behavior to use when this is the first time opening a realm.
newRealmFileBehavior: {
type: "downloadBeforeOpen",
timeout: 120,
timeOutBehaviour: "openLocalRealm"
},
// The behavior to use when a realm file already exists locally,
// i.e. you have previously opened the realm.
existingRealmFileBehavior: {
type: "openImmediately",
timeout: 30,
timeOutBehaviour: "openLocalRealm"
},
},
};
log("async open realm...")
const target_realm = await Realm.open(realmConfig);
```
Anyone have any suggestions on how to debug the cause of the segmentation fault ?
Is the realm-js compatible with node v16.13.0 ?
Thanks
### Stacktrace & log output
```shell
There is no stack trace.
```
### Can you reproduce the bug?
Yes, always
### Reproduction Steps
Script can be provided
### Version
V10.10.1
### What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
### Are you using encryption?
No, not using encryption
### Platform OS and version(s)
macOS 12.0.1
### Build environment
Which debugger for React Native: N/A
Here is the set fault
PID 90660 received SIGSEGV for address: 0x3
0 segfault-handler.node 0x0000000106bd1458 _ZL16segfault_handleriP9__siginfoPv + 272
1 libsystem_platform.dylib 0x000000019a6584e4 _sigtramp + 56
2 realm.node 0x000000010f7a5928 _ZZN5realm6common6logger6Logger17build_sync_loggerERNSt3__18functionIFviNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEEENKUlNS_4util6Logger5LevelEE_clESG_ + 172
3 realm.node 0x000000010f7a5928 _ZZN5realm6common6logger6Logger17build_sync_loggerERNSt3__18functionIFviNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEEENKUlNS_4util6Logger5LevelEE_clESG_ + 172
4 realm.node 0x000000010f7a57e0 _ZNSt3__110__function6__funcIZN5realm6common6logger6Logger17build_sync_loggerERNS_8functionIFviNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEEEUlNS2_4util6Logger5LevelEE_NSA_ISJ_EEFNS_10unique_ptrISH_NS_14default_deleteISH_EEEESI_EEclEOSI_ + 36
5 realm.node 0x000000010f8d394c _ZNK5realm11SyncManager18create_sync_clientEv + 68
6 realm.node 0x000000010f8d2a48 _ZN5realm11SyncManager11get_sessionENSt3__110shared_ptrINS_2DBEEERKNS_10SyncConfigE + 92
7 realm.node 0x000000010f87731c _ZN5realm5_impl16RealmCoordinator19create_sync_sessionEv + 204
8 realm.node 0x000000010f879d24 _ZN5realm5_impl16RealmCoordinator22get_synchronized_realmENS_5Realm6ConfigE + 88
9 realm.node 0x000000010f850538 _ZN5realm5Realm22get_synchronized_realmENS0_6ConfigE + 108
10 realm.node 0x000000010f6b85f8 _ZN5realm2js10RealmClassINS_4node5TypesEE16async_open_realmEN4Napi3EnvENS5_6ObjectERNS0_9ArgumentsIS3_EERNS0_11ReturnValueIS3_EE + 652
11 realm.node 0x000000010f69ebf4 _ZN5realm2js4wrapIXadL_ZNS0_10RealmClassINS_4node5TypesEE16async_open_realmEN4Napi3EnvENS6_6ObjectERNS0_9ArgumentsIS4_EERNS0_11ReturnValueIS4_EEEEEENS6_5ValueERKNS6_12CallbackInfoE + 244
12 realm.node 0x000000010f6ed4b0 _ZN4Napi7details12WrapCallbackIZNS_10ObjectWrapIN5realm4node13WrappedObjectINS3_2js10RealmClassINS4_5TypesEEEEEE27StaticMethodCallbackWrapperEP10napi_env__P20napi_callback_info__EUlvE_EEP12napi_value__T_ + 60
13 realm.node 0x000000010f6ed468 _ZN4Napi10ObjectWrapIN5realm4node13WrappedObjectINS1_2js10RealmClassINS2_5TypesEEEEEE27StaticMethodCallbackWrapperEP10napi_env__P20napi_callback_info__ + 28
14 node 0x000000010242c6f8 _ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE + 104
15 node 0x000000010262032c _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE + 276
16 node 0x000000010261fe24 _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 468
17 node 0x000000010261f6b0 _ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE + 228
18 node 0x0000000102d5d1cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 108
19 node 0x0000000102cf0d18 Builtins_InterpreterEntryTrampoline + 248
20 node 0x0000000102da3700 Builtins_PromiseConstructor + 2176
21 node 0x0000000102cedf50 Builtins_JSBuiltinsConstructStub + 368
22 node 0x0000000102dec070 Builtins_ConstructHandler + 656
23 node 0x0000000102cf0d18 Builtins_InterpreterEntryTrampoline + 248
24 node 0x0000000102cf0d18 Builtins_InterpreterEntryTrampoline + 248
25 node 0x0000000102cf0d18 Builtins_InterpreterEntryTrampoline + 248
26 node 0x0000000102d20314 Builtins_AsyncFunctionAwaitResolveClosure + 84
27 node 0x0000000102da51b8 Builtins_PromiseFulfillReactionJob + 56
28 node 0x0000000102d126f4 Builtins_RunMicrotasks + 596
29 node 0x0000000102cee9e4 Builtins_JSRunMicrotasksEntry + 164
30 node 0x00000001026c31e8 _ZN2v88internal12_GLOBAL__N_16InvokeEPNS0_7IsolateERKNS1_12InvokeParamsE + 2332
31 node 0x00000001026c361c _ZN2v88internal12_GLOBAL__N_118InvokeWithTryCatchEPNS0_7IsolateERKNS1_12InvokeParamsE + 88
Tom has been able to replicate the issue and given me a workaround. The call to setLogger() is resulting in a crash in the logger.
Cheers