ACK tx_data leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'm using pjsip 2.9 for gateway application (pjsip-ua layer). After stress testing my application I found that there are lot of ACK tdata's with 1 reference but without any active dialogs. There are no leakage without stress load though.
I can't find the exact condition when leakage occurs, but I can fix it with this patch. I want to know if I could break anything with this?
diff -ur temp/pjproject-2.9/pjsip/src/pjsip-ua/sip_inv.c pjproject-2.9/pjsip/src/pjsip-ua/sip_inv.c
--- temp/pjproject-2.9/pjsip/src/pjsip-ua/sip_inv.c	2019-05-09 13:18:18.000000000 +0500
+++ pjproject-2.9/pjsip/src/pjsip-ua/sip_inv.c	2019-09-27 12:22:25.582729568 +0500
@@ -456,13 +456,7 @@
      * Must not use the cached ACK if it's still marked as pending
      * by transport (#1011).
      */
-    if (inv->last_ack && rdata->msg_info.cseq->cseq == inv->last_ack_cseq &&
-	inv->last_ack->tp_info.transport != NULL &&
-	!inv->last_ack->is_pending)
-    {
-	pjsip_tx_data_add_ref(inv->last_ack);
-
-    } else if (mod_inv.cb.on_send_ack) {
+	if (mod_inv.cb.on_send_ack) {
 	/* If application handles ACK transmission manually, just notify the
 	 * callback
 	 */
@@ -488,6 +482,7 @@
 	pj_assert(!"Unable to send ACK!");
 	return status;
     }
+    inv->last_ack = NULL;
 
 
     /* Set state to CONFIRMED (if we're not in CONFIRMED yet).
@@ -3155,12 +3150,6 @@
     /* Lock dialog. */
     pjsip_dlg_inc_lock(inv->dlg);
 
-    /* Destroy last_ack */
-    if (inv->last_ack) {
-	pjsip_tx_data_dec_ref(inv->last_ack);
-	inv->last_ack = NULL;
-    }
-
     /* Create new ACK request */
     status = pjsip_dlg_create_request(inv->dlg, pjsip_get_ack_method(), 
 				      cseq, &inv->last_ack);
@@ -3177,7 +3166,6 @@
 
     /* Keep this for subsequent response retransmission */
     inv->last_ack_cseq = cseq;
-    pjsip_tx_data_add_ref(inv->last_ack);
 
     /* Done */
     *p_tdata = inv->last_ack;
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux