Ticket #1684 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Failed assertion when scheduling timer in the registration client

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.2
Component: pjsip Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by bennylp) (diff)

Assertion may happen in the following scenario, only on iPhone:

  1. Add new account with pjsua_acc_add() but without registration
  2. Modify the account with pjsua_acc_modify() to add proxy
  3. Register with pjsua_set_registration()

Step 2 will cause registration to be sent, and so is step 3. On other platform, step 3 will fail with PJ_EBUSY but somehow it causes another registration to be sent after the first registration has completed on iPhone, and assertion will be raised.

Stack trace:

Assertion failed: (entry->_timer_id < 1), function pj_timer_heap_schedule, 
file ../src/pj/timer.c, line 477.
(lldb) 

#0	0x39e3f350 in __pthread_kill ()
#1	0x39db6122 in pthread_kill ()
#2	0x39df2972 in abort ()
#3	0x39dd34d0 in __assert_rtn ()
#4	0x003d688c in pj_timer_heap_schedule ()
#5	0x00384094 in pjsip_endpt_schedule_timer ()
#6	0x0037226e in schedule_registration ()
#7	0x003733d6 in regc_tsx_callback ()
#8	0x0038f468 in mod_util_on_tsx_state ()
#9	0x0038cdf8 in tsx_set_state ()
#10	0x0038d2aa in tsx_on_state_proceeding_uac ()
#11	0x0038d174 in tsx_on_state_calling ()
#12	0x0038e6e2 in pjsip_tsx_recv_msg ()
#13	0x0038c7b0 in mod_tsx_layer_on_rx_response ()
#14	0x00384008 in pjsip_endpt_process_rx_data ()
#15	0x0038474a in endpt_on_rx_msg ()
#16	0x00386fe6 in pjsip_tpmgr_receive_packet ()
#17	0x00388612 in udp_on_read_complete ()
#18	0x003ce8f6 in ioqueue_dispatch_read_event ()
#19	0x003ceb24 in pj_ioqueue_poll ()
#20	0x0038411a in pjsip_endpt_handle_events2 ()
#21	0x003621ba in worker_thread ()
#22	0x003cfa54 in thread_main ()

Change History

comment:1 Changed 5 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 5 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to fixed

In 4548:

Fixed #1684 (Failed assertion when scheduling timer in the registration client):

  • There is a potential race condition in pjsip_regc_set_delay_before_refresh() because it calls schedule_registration() without mutex protection
  • Check if the timer is active and cancel it in schedule_registration() as precaution
Note: See TracTickets for help on using tickets.