You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asterisk/third-party/pjproject/patches/0035-r5572-svn-backport-dia...

33 lines
1.2 KiB

Index: trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- a/pjsip/src/pjsip/sip_transaction.c (revision 5244)
+++ b/pjsip/src/pjsip/sip_transaction.c (revision 5572)
@@ -1231,5 +1231,27 @@
PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src,
prev_state);
+
+ /* For timer event, release lock to avoid deadlock.
+ * This should be safe because:
+ * 1. The tsx state just switches to TERMINATED or DESTROYED.
+ * 2. There should be no other processing taking place. All other
+ * events, such as the ones handled by tsx_on_state_terminated()
+ * should be ignored.
+ * 3. tsx_shutdown() hasn't been called.
+ * Refer to ticket #2001 (https://trac.pjsip.org/repos/ticket/2001).
+ */
+ if (event_src_type == PJSIP_EVENT_TIMER &&
+ (pj_timer_entry *)event_src == &tsx->timeout_timer)
+ {
+ pj_grp_lock_release(tsx->grp_lock);
+ }
+
(*tsx->tsx_user->on_tsx_state)(tsx, &e);
+
+ if (event_src_type == PJSIP_EVENT_TIMER &&
+ (pj_timer_entry *)event_src == &tsx->timeout_timer)
+ {
+ pj_grp_lock_acquire(tsx->grp_lock);
+ }
}