Ignore:
Timestamp:
Mar 29, 2017 12:43:52 AM (8 years ago)
Author:
ming
Message:

Fixed #2001: Deadlock between dialog lock and transaction group lock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r5244 r5572  
    12311231        PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src, 
    12321232                                   prev_state); 
     1233 
     1234        /* For timer event, release lock to avoid deadlock. 
     1235         * This should be safe because: 
     1236         * 1. The tsx state just switches to TERMINATED or DESTROYED. 
     1237         * 2. There should be no other processing taking place. All other 
     1238         *    events, such as the ones handled by tsx_on_state_terminated() 
     1239         *    should be ignored. 
     1240         * 3. tsx_shutdown() hasn't been called. 
     1241         * Refer to ticket #2001 (https://trac.pjsip.org/repos/ticket/2001). 
     1242         */ 
     1243        if (event_src_type == PJSIP_EVENT_TIMER && 
     1244            (pj_timer_entry *)event_src == &tsx->timeout_timer) 
     1245        { 
     1246            pj_grp_lock_release(tsx->grp_lock); 
     1247        } 
     1248 
    12331249        (*tsx->tsx_user->on_tsx_state)(tsx, &e); 
     1250 
     1251        if (event_src_type == PJSIP_EVENT_TIMER && 
     1252            (pj_timer_entry *)event_src == &tsx->timeout_timer) 
     1253        { 
     1254            pj_grp_lock_acquire(tsx->grp_lock); 
     1255        } 
    12341256    } 
    12351257     
Note: See TracChangeset for help on using the changeset viewer.