Re: [pjsip] many crashes in iOS10, maybe because to keep-alive timer

Q
qiulang
Thu, Oct 27, 2016 3:20 PM

Hi,

I finally catch the crash in Xcode. It seems to confirm my guess.

Assertion failed: (entry-cb != ((void*)0)), function schedule_w_grp_lock, file ../src/pj/timer.c, line 501.
(lldb)

PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt,
pj_timer_entry *entry,
const pj_time_val *delay )
{
PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%u.%u)",
entry, delay-sec, delay-msec));
return pj_timer_heap_schedule( endpt-timer_heap, entry, delay );
}

Any idea how to fix it ?

Thanks,

Qiulang

Original Message
Sender:qiulangqiulang@emicnet.com
Recipient:pjsippjsip@lists.pjsip.org
Date:Tuesday, Oct 25, 2016 10:04
Subject:[pjsip] many crashes in iOS10, maybe because to keep-alive timer

Hi,

I found that pjsip2.5 crashes a lot in iOS 10, I finally got the crash logs. I suspect this maybe because iOS 10 formally forbid keep-alive when app is in background and pjsip keep-alive timer causes that.

So how do I disable keep-alive timer when I want to ? Can just settcp-ka_timer.id=PJ_FALSEdoes the job ? But it could be another reason. Any ideas ?

Thanks!

Qiulang

on_connect_complete (sip_transport_tcp.c:1583)

/* Start keep-alive timer */
if (pjsip_cfg()-tcp.keep_alive_interval) {
pj_time_val delay = { 0 };
delay.sec = pjsip_cfg()-tcp.keep_alive_interval;
pjsip_endpt_schedule_timer(tcp-base.endpt, tcp-ka_timer,
delay);
tcp-ka_timer.id = PJ_TRUE;

0 libsystem_kernel.dylib 0x000000018a1f6014 __pthread_kill + 8 1 libsystem_pthread.dylib 0x000000018a2bd460 pthread_kill + 108 2 libsystem_c.dylib 0x000000018a16a3f4 abort + 136 3 libsystem_c.dylib 0x000000018a13e40c __assert_rtn + 312 4 ipjsua 0x0000000100a5e170 schedule_w_grp_lock + 776 5 ipjsua 0x0000000100146278 on_connect_complete (sip_transport_tcp.c:1583) 6 ipjsua 0x0000000100a55f54 ioqueue_on_connect_complete + 48 7 ipjsua 0x0000000100a5058c ioqueue_dispatch_write_event + 628 8 ipjsua 0x0000000100a524b4 pj_ioqueue_poll + 720 9 ipjsua 0x00000001002178b4 pjsip_endpt_handle_events2 (sip_endpoint.c:742) 10 ipjsua 0x00000001001b891c pjsua_handle_events (pjsua_core.c:1976) 11 ipjsua 0x00000001001b81d4 worker_thread (pjsua_core.c:701) 12 ipjsua 0x0000000100a535e4 thread_main + 80 13 libsystem_pthread.dylib 0x000000018a2bb860 _pthread_body + 236 14 libsystem_pthread.dylib 0x000000018a2bb770 _pthread_start + 280 15 libsystem_pthread.dylib 0x000000018a2b8dbc thread_start + 0

Hi, I finally catch the crash in Xcode. It seems to confirm my guess. Assertion failed: (entry-cb != ((void*)0)), function schedule_w_grp_lock, file ../src/pj/timer.c, line 501. (lldb) PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt, pj_timer_entry *entry, const pj_time_val *delay ) { PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%u.%u)", entry, delay-sec, delay-msec)); return pj_timer_heap_schedule( endpt-timer_heap, entry, delay ); } Any idea how to fix it ? Thanks, Qiulang Original Message Sender:qiulangqiulang@emicnet.com Recipient:pjsippjsip@lists.pjsip.org Date:Tuesday, Oct 25, 2016 10:04 Subject:[pjsip] many crashes in iOS10, maybe because to keep-alive timer Hi, I found that pjsip2.5 crashes a lot in iOS 10, I finally got the crash logs. I suspect this maybe because iOS 10 formally forbid keep-alive when app is in background and pjsip keep-alive timer causes that. So how do I disable keep-alive timer when I want to ? Can just settcp-ka_timer.id=PJ_FALSEdoes the job ? But it could be another reason. Any ideas ? Thanks! Qiulang on_connect_complete (sip_transport_tcp.c:1583) /* Start keep-alive timer */ if (pjsip_cfg()-tcp.keep_alive_interval) { pj_time_val delay = { 0 }; delay.sec = pjsip_cfg()-tcp.keep_alive_interval; pjsip_endpt_schedule_timer(tcp-base.endpt, tcp-ka_timer, delay); tcp-ka_timer.id = PJ_TRUE; 0 libsystem_kernel.dylib 0x000000018a1f6014 __pthread_kill + 8 1 libsystem_pthread.dylib 0x000000018a2bd460 pthread_kill + 108 2 libsystem_c.dylib 0x000000018a16a3f4 abort + 136 3 libsystem_c.dylib 0x000000018a13e40c __assert_rtn + 312 4 ipjsua 0x0000000100a5e170 schedule_w_grp_lock + 776 5 ipjsua 0x0000000100146278 on_connect_complete (sip_transport_tcp.c:1583) 6 ipjsua 0x0000000100a55f54 ioqueue_on_connect_complete + 48 7 ipjsua 0x0000000100a5058c ioqueue_dispatch_write_event + 628 8 ipjsua 0x0000000100a524b4 pj_ioqueue_poll + 720 9 ipjsua 0x00000001002178b4 pjsip_endpt_handle_events2 (sip_endpoint.c:742) 10 ipjsua 0x00000001001b891c pjsua_handle_events (pjsua_core.c:1976) 11 ipjsua 0x00000001001b81d4 worker_thread (pjsua_core.c:701) 12 ipjsua 0x0000000100a535e4 thread_main + 80 13 libsystem_pthread.dylib 0x000000018a2bb860 _pthread_body + 236 14 libsystem_pthread.dylib 0x000000018a2bb770 _pthread_start + 280 15 libsystem_pthread.dylib 0x000000018a2b8dbc thread_start + 0