Hi Aditya, This may be similar to: https://trac.pjsip.org/repos/ticket/1548 You can try this and feedback us whether it works for your case. Thanks. Regards, Ming On Thu, Jul 19, 2012 at 3:10 AM, Aditya Mavlankar <aditya.mavlankar at tely.com> wrote: > Hi, > > I am using ICE in a standalone manner in a demo that I am trying to > build. Sometimes, when I am deallocating after I am done using the ICE > stream transport, I get a crash because of assert failure in file > timer.c in function > > static int cancel( pj_timer_heap_t *ht, > pj_timer_entry *entry, > int dont_call) > > Basically, the following fails: > > if (entry != ht->heap[timer_node_slot]) > { > pj_assert(entry == ht->heap[timer_node_slot]); > return 0; > } > > Based on icedemo example, I first destroy ICE stream transport and > then wait for the handle_events thread to join. Something like this: > if (icedemo.icest) > pj_ice_strans_destroy(icedemo.icest); > > pj_thread_sleep(500); > > icedemo.thread_quit_flag = PJ_TRUE; > if (icedemo.thread) { > pj_thread_join(icedemo.thread); > pj_thread_destroy(icedemo.thread); > } > > The only difference in my case is that I have multiple ICE stream > transport objects which I destroy before quitting the thread. > > It seems to crash while processing some event in ioqueue: > > Stack frame #01 pc 0007a754 Routine cancel in ../src/pj/timer.c:391 > Stack frame #02 pc 0007ae34 Routine pj_timer_heap_cancel in > ../src/pj/timer.c:536 > Stack frame #03 pc 00050d30 Routine sess_shutdown in > ../src/pjnath/turn_session.c:453 > Stack frame #04 pc 00053050 Routine on_allocate_success in > ../src/pjnath/turn_session.c:1454 > Stack frame #05 pc 000535f0 Routine stun_on_request_complete in > ../src/pjnath/turn_session.c:1619 > Stack frame #06 pc 0004a748 Routine stun_tsx_on_complete in > ../src/pjnath/stun_session.c:463 > Stack frame #07 pc 000503f0 Routine pj_stun_client_tsx_on_rx_msg in (null):0 > Stack frame #08 pc 0004c974 Routine on_incoming_response in > ../src/pjnath/stun_session.c:1375 > Stack frame #09 pc 0004d0a8 Routine pj_stun_session_on_rx_pkt in (null):0 > Stack frame #10 pc 00052be4 Routine pj_turn_session_on_rx_pkt in > ../src/pjnath/turn_session.c:1320 > Stack frame #11 pc 00055d90 Routine on_data_read in > ../src/pjnath/turn_sock.c:695 > Stack frame #12 pc 0006e6f0 Routine ioqueue_on_read_complete in > ../src/pj/activesock.c:624 > Stack frame #13 pc 00064c38 Routine ioqueue_dispatch_read_event in > ../src/pj/ioqueue_common_abs.c:627 > Stack frame #14 pc 00067460 Routine pj_ioqueue_poll in (null):0 > Stack frame #15 pc 0002747c Routine handle_events in > /home/xyz/test_ice.cpp:139 > > Should I first stop the thread that is polling for events and then > destroy ICE stream transport? > > Best, > Aditya > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org