process abort in pjsip, on 1st callback

KY
Kazuhiko YONEDA
Sat, Jun 16, 2018 10:43 AM

Hi,
I am prototyping an application using pjsip on the Android platform.

I use https://svn.pjsip.org/repos/pjproject/tags/2.7.2, pjsua2 high level APIs (Java).
I encountered a problem while debugging my application.

  • The application process aborts.
  • It occurs in the first callback (e.g. onCallState).
  • The address where the exception occurs is in the native library.
    (e.g.)
    ----- android's logcat ---------------
    06-12 20:35:13.215 I/crash_dump64(19482): performing dump of process 19390 (target tid = 19410)
    06-12 20:35:13.215 F/DEBUG  (19482): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    06-12 20:35:13.216 F/DEBUG  (19482): Revision: '0'
    06-12 20:35:13.216 F/DEBUG  (19482): ABI: 'arm64'
    06-12 20:35:13.216 F/DEBUG  (19482): pid: 19390, tid: 19410, name: Thread-62  >>> org.foobar.extension <<<
    06-12 20:35:13.216 F/DEBUG  (19482): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    06-12 20:35:13.226 F/DEBUG  (19482): Abort message: 'terminating with uncaught exception of type Swig::DirectorException: No enum class org.pjsip.pjsua2.pjsip_tsx_state_e with value 377750600'
    06-12 20:35:13.226 F/DEBUG  (19482):    x0  0000000000000000  x1  0000000000004bd2  x2  0000000000000006  x3  0000000000000008
    06-12 20:35:13.226 F/DEBUG  (19482):    x4  fefefefefefeff44  x5  fefefefefefeff44  x6  fefefefefefeff44  x7  7f7f7f7f7f7f7f7f
    06-12 20:35:13.226 F/DEBUG  (19482):    x8  0000000000000083  x9  ea4abc7db21296c0  x10  0000000000000000  x11  0000000000000001
    06-12 20:35:13.226 F/DEBUG  (19482):    x12  ffffffffffffffff  x13  0000000000000001  x14  0003aca76eb20f9a  x15  000097dd28145c85
    06-12 20:35:13.226 F/DEBUG  (19482):    x16  00000070e79e12f0  x17  00000070e7985c90  x18  00000000ebad6082  x19  0000000000004bbe
    06-12 20:35:13.226 F/DEBUG  (19482):    x20  0000000000004bd2  x21  00000070cd5c8758  x22  00000000ffffff80  x23  00000000ffffffc8
    06-12 20:35:13.226 F/DEBUG  (19482):    x24  00000070cd5c8820  x25  00000070cd5c86f0  x26  00000070cd5c8730  x27  0000000000000000
    06-12 20:35:13.226 F/DEBUG  (19482):    x28  0000000000000001  x29  00000070cd5c8660  x30  00000070e7939d94
    06-12 20:35:13.226 F/DEBUG  (19482):    sp  00000070cd5c8620  pc  00000070e7985c98  pstate 0000000060000000
    06-12 20:35:13.235 W/StreamHAL(  516): Error from HAL stream in function get_presentation_position: Operation not permitted
    06-12 20:35:13.247 F/DEBUG  (19482):
    06-12 20:35:13.247 F/DEBUG  (19482): backtrace:
    06-12 20:35:13.247 F/DEBUG  (19482):    #00 pc 0000000000069c98  /system/lib64/libc.so (tgkill+8)
    06-12 20:35:13.247 F/DEBUG  (19482):    #01 pc 000000000001dd90  /system/lib64/libc.so (abort+88)
    06-12 20:35:13.247 F/DEBUG  (19482):    #02 pc 000000000023b4bc  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.247 F/DEBUG  (19482):    #03 pc 000000000023b5cc  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.247 F/DEBUG  (19482):    #04 pc 00000000002385e4  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.247 F/DEBUG  (19482):    #05 pc 0000000000237e5c  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (__cxa_throw+128)
    06-12 20:35:13.247 F/DEBUG  (19482):    #06 pc 00000000000a0414  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN17SwigDirector_Call11onCallStateERN2pj16OnCallStateParamE+504)
    06-12 20:35:13.247 F/DEBUG  (19482):    #07 pc 000000000011cadc  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN2pj4Call18processStateChangeERNS_16OnCallStateParamE+200)
    06-12 20:35:13.247 F/DEBUG  (19482):    #08 pc 0000000000105b00  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN2pj8Endpoint13on_call_stateEiP11pjsip_event+72)
    06-12 20:35:13.247 F/DEBUG  (19482):    #09 pc 0000000000133aa4  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.247 F/DEBUG  (19482):    #10 pc 00000000001525ec  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.247 F/DEBUG  (19482):    #11 pc 0000000000151cc4  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #12 pc 000000000017f810  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_dlg_on_tsx_state+152)
    06-12 20:35:13.248 F/DEBUG  (19482):    #13 pc 000000000017aa08  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #14 pc 000000000017a1e4  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #15 pc 000000000017ad2c  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_tsx_send_msg+148)
    06-12 20:35:13.248 F/DEBUG  (19482):    #16 pc 000000000017e804  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_dlg_send_request+452)
    06-12 20:35:13.248 F/DEBUG  (19482):    #17 pc 0000000000151178  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_inv_send_msg+524)
    06-12 20:35:13.248 F/DEBUG  (19482):    #18 pc 0000000000135930  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #19 pc 0000000000143d8c  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #20 pc 000000000014283c  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #21 pc 0000000000145a84  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #22 pc 0000000000229058  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pj_timer_heap_poll+220)
    06-12 20:35:13.248 F/DEBUG  (19482):    #23 pc 000000000016d2b0  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_endpt_handle_events2+48)
    06-12 20:35:13.248 F/DEBUG  (19482):    #24 pc 000000000013c000  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #25 pc 000000000021d034  /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so
    06-12 20:35:13.248 F/DEBUG  (19482):    #26 pc 0000000000066620  /system/lib64/libc.so (_ZL15__pthread_startPv+36)
    06-12 20:35:13.248 F/DEBUG  (19482):    #27 pc 000000000001f124  /system/lib64/libc.so (__start_thread+68)

I solved this trouble as a result of trial and error.
Attach the code difference added to the mother code of pjsip 2.7.2.

I will write my opinion below:

  1. some pjsua2's C++ constructor does not initialize basic type data member.
  2. If it is an enum mapping of SWIG, SWIG will throw an exception.
    C ++ does not implicitly initialize basic types (ZERO overhead rule).
    I think that the default constructor should be initialized so that an undefined value does not occur.

Best regards

Hi, I am prototyping an application using pjsip on the Android platform. I use https://svn.pjsip.org/repos/pjproject/tags/2.7.2, pjsua2 high level APIs (Java). I encountered a problem while debugging my application. - The application process aborts. - It occurs in the first callback (e.g. onCallState). - The address where the exception occurs is in the native library. (e.g.) ----- android's logcat --------------- 06-12 20:35:13.215 I/crash_dump64(19482): performing dump of process 19390 (target tid = 19410) 06-12 20:35:13.215 F/DEBUG (19482): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-12 20:35:13.216 F/DEBUG (19482): Revision: '0' 06-12 20:35:13.216 F/DEBUG (19482): ABI: 'arm64' 06-12 20:35:13.216 F/DEBUG (19482): pid: 19390, tid: 19410, name: Thread-62 >>> org.foobar.extension <<< 06-12 20:35:13.216 F/DEBUG (19482): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 06-12 20:35:13.226 F/DEBUG (19482): Abort message: 'terminating with uncaught exception of type Swig::DirectorException: No enum class org.pjsip.pjsua2.pjsip_tsx_state_e with value 377750600' 06-12 20:35:13.226 F/DEBUG (19482): x0 0000000000000000 x1 0000000000004bd2 x2 0000000000000006 x3 0000000000000008 06-12 20:35:13.226 F/DEBUG (19482): x4 fefefefefefeff44 x5 fefefefefefeff44 x6 fefefefefefeff44 x7 7f7f7f7f7f7f7f7f 06-12 20:35:13.226 F/DEBUG (19482): x8 0000000000000083 x9 ea4abc7db21296c0 x10 0000000000000000 x11 0000000000000001 06-12 20:35:13.226 F/DEBUG (19482): x12 ffffffffffffffff x13 0000000000000001 x14 0003aca76eb20f9a x15 000097dd28145c85 06-12 20:35:13.226 F/DEBUG (19482): x16 00000070e79e12f0 x17 00000070e7985c90 x18 00000000ebad6082 x19 0000000000004bbe 06-12 20:35:13.226 F/DEBUG (19482): x20 0000000000004bd2 x21 00000070cd5c8758 x22 00000000ffffff80 x23 00000000ffffffc8 06-12 20:35:13.226 F/DEBUG (19482): x24 00000070cd5c8820 x25 00000070cd5c86f0 x26 00000070cd5c8730 x27 0000000000000000 06-12 20:35:13.226 F/DEBUG (19482): x28 0000000000000001 x29 00000070cd5c8660 x30 00000070e7939d94 06-12 20:35:13.226 F/DEBUG (19482): sp 00000070cd5c8620 pc 00000070e7985c98 pstate 0000000060000000 06-12 20:35:13.235 W/StreamHAL( 516): Error from HAL stream in function get_presentation_position: Operation not permitted 06-12 20:35:13.247 F/DEBUG (19482): 06-12 20:35:13.247 F/DEBUG (19482): backtrace: 06-12 20:35:13.247 F/DEBUG (19482): #00 pc 0000000000069c98 /system/lib64/libc.so (tgkill+8) 06-12 20:35:13.247 F/DEBUG (19482): #01 pc 000000000001dd90 /system/lib64/libc.so (abort+88) 06-12 20:35:13.247 F/DEBUG (19482): #02 pc 000000000023b4bc /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.247 F/DEBUG (19482): #03 pc 000000000023b5cc /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.247 F/DEBUG (19482): #04 pc 00000000002385e4 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.247 F/DEBUG (19482): #05 pc 0000000000237e5c /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (__cxa_throw+128) 06-12 20:35:13.247 F/DEBUG (19482): #06 pc 00000000000a0414 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN17SwigDirector_Call11onCallStateERN2pj16OnCallStateParamE+504) 06-12 20:35:13.247 F/DEBUG (19482): #07 pc 000000000011cadc /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN2pj4Call18processStateChangeERNS_16OnCallStateParamE+200) 06-12 20:35:13.247 F/DEBUG (19482): #08 pc 0000000000105b00 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (_ZN2pj8Endpoint13on_call_stateEiP11pjsip_event+72) 06-12 20:35:13.247 F/DEBUG (19482): #09 pc 0000000000133aa4 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.247 F/DEBUG (19482): #10 pc 00000000001525ec /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.247 F/DEBUG (19482): #11 pc 0000000000151cc4 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #12 pc 000000000017f810 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_dlg_on_tsx_state+152) 06-12 20:35:13.248 F/DEBUG (19482): #13 pc 000000000017aa08 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #14 pc 000000000017a1e4 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #15 pc 000000000017ad2c /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_tsx_send_msg+148) 06-12 20:35:13.248 F/DEBUG (19482): #16 pc 000000000017e804 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_dlg_send_request+452) 06-12 20:35:13.248 F/DEBUG (19482): #17 pc 0000000000151178 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_inv_send_msg+524) 06-12 20:35:13.248 F/DEBUG (19482): #18 pc 0000000000135930 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #19 pc 0000000000143d8c /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #20 pc 000000000014283c /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #21 pc 0000000000145a84 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #22 pc 0000000000229058 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pj_timer_heap_poll+220) 06-12 20:35:13.248 F/DEBUG (19482): #23 pc 000000000016d2b0 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so (pjsip_endpt_handle_events2+48) 06-12 20:35:13.248 F/DEBUG (19482): #24 pc 000000000013c000 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #25 pc 000000000021d034 /data/app/org.foobar.extension-E4Qk8hX8Sx_gamaaDiS78Q==/lib/arm64/libpjsua2.so 06-12 20:35:13.248 F/DEBUG (19482): #26 pc 0000000000066620 /system/lib64/libc.so (_ZL15__pthread_startPv+36) 06-12 20:35:13.248 F/DEBUG (19482): #27 pc 000000000001f124 /system/lib64/libc.so (__start_thread+68) ---------------------------- I solved this trouble as a result of trial and error. Attach the code difference added to the mother code of pjsip 2.7.2. I will write my opinion below: 1. some pjsua2's C++ constructor does not initialize basic type data member. 2. If it is an enum mapping of SWIG, SWIG will throw an exception. C ++ does not implicitly initialize basic types (ZERO overhead rule). I think that the default constructor should be initialized so that an undefined value does not occur. Best regards