MayamaTakeshi / sip-lab

A node module that helps to write SIP functional tests
3 stars 2 forks source link

Segfault in Debian 10 #1

Closed MayamaTakeshi closed 3 years ago

MayamaTakeshi commented 3 years ago

sip-lab was failing to build on Debian 10. We did the necessary adjustments but running

  node samples/simple.js

is resulting in crash. Running under gdb we see:


Thread 1 "node" received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
120     ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
(gdb) bt                         
#0  0x00007ffff7b40206 in __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
#1  0x00007ffff7af99ef in _IO_vfprintf_internal (s=0x7fffffff6af0, format=0x7ffff52533ec "on_rx_request %.*s\n\n", ap=0x7fffffff91b0) at vfprintf.c:1638
#2  0x00007ffff7afa866 in buffered_vfprintf (s=s@entry=0x7ffff7c64760 <_IO_2_1_stdout_>, format=format@entry=0x7ffff52533ec "on_rx_request %.*s\n\n", args=args@entry=0x7fffffff91b0) at vfprintf.c:2322   
#3  0x00007ffff7af7eb2 in _IO_vfprintf_internal (s=0x7ffff7c64760 <_IO_2_1_stdout_>, format=0x7ffff52533ec "on_rx_request %.*s\n\n", ap=ap@entry=0x7fffffff91b0) at vfprintf.c:1296
#4  0x00007ffff7b00606 in __printf (format=<optimized out>) at printf.c:33
#5  0x00007ffff51ccbe6 in _addon_log(int, char const*, ...) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
#6  0x00007ffff51d81a9 in on_rx_request(pjsip_rx_data*) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
#7  0x00007ffff520b94b in pjsip_endpt_process_rx_data (p_handled=0x7fffffffa75c, p=0x7fffffffa780, rdata=0x266f488, endpt=0x261e7a8) at ../src/pjsip/sip_endpoint.c:887
#8  0x00007ffff520b94b in pjsip_endpt_process_rx_data (endpt=0x261e7a8, rdata=0x266f488, p=<optimized out>, p_handled=0x7fffffffa75c) at ../src/pjsip/sip_endpoint.c:824
#9  0x00007ffff520bb56 in endpt_on_rx_msg (endpt=0x261e7a8, status=<optimized out>, rdata=0x266f488) at ../src/pjsip/sip_endpoint.c:1037
#10 0x00007ffff52117a6 in pjsip_tpmgr_receive_packet (mgr=<optimized out>, rdata=rdata@entry=0x266f488) at ../src/pjsip/sip_transport.c:1938
#11 0x00007ffff5213a4f in udp_on_read_complete (key=0x26257e8, op_key=<optimized out>, bytes_read=<optimized out>) at ../src/pjsip/sip_transport_udp.c:170
#12 0x00007ffff5236e28 in ioqueue_dispatch_read_event (h=0x26257e8, ioqueue=0x2629600) at ../src/pj/ioqueue_common_abs.c:605
#13 0x00007ffff5236e28 in ioqueue_dispatch_read_event (ioqueue=0x2629600, h=0x26257e8) at ../src/pj/ioqueue_common_abs.c:433
#14 0x00007ffff52386cf in pj_ioqueue_poll (ioqueue=0x2629600, timeout=timeout@entry=0x7fffffffb190) at ../src/pj/ioqueue_select.c:981
#15 0x00007ffff520b70a in pjsip_endpt_handle_events2 (endpt=0x261e7a8, max_timeout=0x7fffffffb1d0, p_count=0x0) at ../src/pjsip/sip_endpoint.c:742
#16 0x00007ffff51cf824 in handle_events() () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
#17 0x00007ffff51d00a4 in __pjw_poll(char*) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node                                                                                 
#18 0x00007ffff51dab71 in do_poll(Napi::CallbackInfo const&) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
#19 0x00007ffff51e4923 in Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) ()
    at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
#20 0x00000000008e85b5 in (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) ()
#21 0x0000000000b62a3f in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObj
ect>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
#22 0x0000000000b635a9 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
#23 0x0000309d62fdbe1d in  ()           
#24 0x0000309d62fdbd81 in  ()                              
#25 0x00007fffffffc550 in  ()         
#26 0x0000000000000006 in  ()                                        
#27 0x00007fffffffc5f8 in  ()              
#28 0x0000309d62f918d5 in  ()        
#29 0x00003673ac6826f1 in  ()              
#30 0x000012d9e81e70c9 in  ()
#31 0x0000000500000000 in  ()                     
#32 0x00003673ac682801 in  ()
MayamaTakeshi commented 3 years ago

Problem was at _addon_log (src/log.cpp). We had to enclose call to printf() within flockfile(stdout) and funlockfile(stdout).