getdns-node
                                
                                 getdns-node copied to clipboard
                                
                                    getdns-node copied to clipboard
                            
                            
                            
                        SIGSEGV once in a while while running tests
When running the test suite for v2.0.0-alpha.1, it might happen that a SIGSEGV is thrown. The cause is unclear, and it only happens every few hundred test cases or few thousand DNS lookups.
- It might be related to outstanding queries.
- There might be a race condition.
- It might be because of ctx.destroy()being called from acallback.
This needs more investigation.
See for example
- https://github.com/getdnsapi/getdns-node/blob/develop/getdns.js#L50-L59
- https://github.com/getdnsapi/getdns-node/blob/develop/src/GNContext.cpp#L665-L681
Sample console output:
PID 83504 received SIGSEGV for address: 0x10
0   segfault-handler.node               0x00000001022e9d2b _ZL16segfault_handleriP9__siginfoPv + 283
1   libsystem_platform.dylib            0x00007fff9264ef1a _sigtramp + 26
2   ???                                 0x0000000300000000 0x0 + 12884901888
3   libunbound.2.dylib                  0x000000010473cb3f comm_point_close + 32
4   libunbound.2.dylib                  0x00000001047408a1 portcomm_loweruse + 58
5   libunbound.2.dylib                  0x000000010474354e serviced_delete + 68
6   libunbound.2.dylib                  0x000000010470ecab outbound_list_clear + 30
7   libunbound.2.dylib                  0x00000001046ff986 iter_clear + 46
8   libunbound.2.dylib                  0x000000010470d04a mesh_state_cleanup + 279
9   libunbound.2.dylib                  0x000000010470bc3f mesh_state_delete + 352
10  libunbound.2.dylib                  0x000000010470b7f6 mesh_delete + 38
11  libunbound.2.dylib                  0x00000001046ee65d libworker_delete_env + 42
12  libunbound.2.dylib                  0x00000001046ee615 libworker_delete_event + 22
13  libunbound.2.dylib                  0x00000001046eb7a9 ub_ctx_delete + 829
14  libgetdns.1.dylib                   0x00000001046a7bfe getdns_context_destroy + 126
15  getdns.node                         0x00000001043c8ef0 _ZN9GNContext7DestroyERKN3Nan20FunctionCallbackInfoIN2v85ValueEEE + 92
16  getdns.node                         0x00000001043caedd _ZN3Nan3impL23FunctionCallbackWrapperERKN2v820FunctionCallbackInfoINS1_5ValueEEE + 141
17  node                                0x00000001001795d1 _ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE + 369
18  node                                0x00000001001e73ac _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 924
19  node                                0x00000001001e6809 _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE + 281
20  ???                                 0x00003e3fad2843a7 0x0 + 68443208958887
21  ???                                 0x00003e3fad5d8719 0x0 + 68443212449561
- The SIGSEGV happens intermittently on all tested versions of node.js.
- Rerunning tests usually works fine, also on the build server.
- getdns-node is currently targeting getdns v1.0.0.
- The build server only reports the last part of the stack trace, which is the segfault-handlerinstalled to, eh, show stack traces.
- Locally a full stack trace is shown, as well as a crash.logproduced.
Sample build server output, from #103.5 failed building Pull Request #22 Release/v2.0.0-alpha.1.
PID 5612 received SIGSEGV for address: 0x4bc4730
/home/travis/build/getdnsapi/getdns-node/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b23)[0x7f55279b9b23]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f5537033cb0]
[0x4bc4730]