Hi Ming, I tried the changes that you pointed out. It is still crashing. Either the assert in timer.c fails or some function in timer.c crashes. For example, the last line in this function: static void copy_node( pj_timer_heap_t *ht, int slot, pj_timer_entry *moved_node ) { PJ_CHECK_STACK(); // Insert <moved_node> into its new location in the heap. ht->heap[slot] = moved_node; // Update the corresponding slot in the parallel <timer_ids_> array. ht->timer_ids[moved_node->_timer_id] = slot; } Any ideas? It almost feels like some kind of data corruption. Btw. should I try to end the handle_events thread before destroying the ICE stream transport objects? Best, Aditya > 2. Re: crash while using ICE (Ming) > ------------------------------ > > Message: 2 > Date: Fri, 20 Jul 2012 10:11:28 +0800 > From: Ming <ming@xxxxxxxxx> > To: pjsip list <pjsip at lists.pjsip.org> > Subject: Re: crash while using ICE > Message-ID: > <CAPimFqDeMLh0r9NjspjtE=FB99HkPuue-uQv+6roZ2-M7MUKQw at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > 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 > >