asfernandes / node-firebird-drivers

Node.js Firebird Drivers
MIT License
53 stars 17 forks source link

ResultSet closeAsync cause a segfault #64

Open mreis1 opened 4 years ago

mreis1 commented 4 years ago

Hello @asfernandes I came across this error recently. I know it occurs when this.resultSetHandle!.closeAsync(status) is called at line 36 of node-firebird-driver-native/src/lib/resultset.ts

Using segfault-handler I manage to capture the native addon stack trace. Do you have an idea of what might be going wrong ? Is there a way to handle this error?


[
  "0   segfault-handler.node               0x000000010df8e040 _ZL16segfault_handleriP9__siginfoPv + 304",
  "1   libsystem_platform.dylib            0x00007fff6a6ef42d _sigtramp + 29",
  "2   addon.node                          0x0000000109f3f86c _ZNSt3__110__function6__funcIZN9ResultSet10closeStartEbRKN4Napi12CallbackInfoEE5$_131NS_9allocatorIS7_EEFPvvEEclEv + 88",
  "3   addon.node                          0x0000000109e95c2b _ZN13PromiseWorkerIPvE7ExecuteEv + 89",
  "4   addon.node                          0x0000000109e9601b _ZN4Napi17CustomAsyncWorker9OnExecuteEP10napi_env__Pv + 23",
  "5   node                                0x00000001009e030c worker + 274",
  "6   libsystem_pthread.dylib             0x00007fff6a6fae65 _pthread_start + 148",
  "7   libsystem_pthread.dylib             0x00007fff6a6f683b thread_start + 15"
]
asfernandes commented 4 years ago

It could happen if you call async functions not awaiting (with await or promises.then) them and calling another async functions related. For example: calling close two times. Closing a resultSet and the connection simultaneously.

If it's not the case it could be analyzed with a more or less consistent reproducable test case.

mreis1 commented 4 years ago

Ok. I'll attempt to create some use cases and post them here.