qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject [qpid-dispatch] branch master updated: DISPATCH-1283 - Zero out link references on deliveries before they are freed. Moved global and link related counters update into its own function. This closes #461
Date Thu, 14 Mar 2019 14:46:01 GMT
This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new f50c708  DISPATCH-1283 - Zero out link references on deliveries before they are freed.
Moved global and link related counters update into its own function. This closes #461
f50c708 is described below

commit f50c7088e55b221516f90fcf2086276f748163be
Author: Ganesh Murthy <gmurthy@redhat.com>
AuthorDate: Thu Mar 14 10:44:28 2019 -0400

    DISPATCH-1283 - Zero out link references on deliveries before they are freed. Moved global
and link related counters update into its own function. This closes #461
---
 src/router_core/connections.c         | 18 +++++++++++
 src/router_core/router_core_private.h |  5 +++
 src/router_core/transfer.c            | 57 ++++++++++++++++++++---------------
 3 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index b078efb..1ac8bcf 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -706,6 +706,12 @@ static void qdr_link_cleanup_deliveries_CT(qdr_core_t *core, qdr_connection_t
*c
         }
 
         //
+        // Updates global and link level delivery counters like presettled_deliveries, accepted_deliveries,
released_deliveries etc
+        //
+        qdr_increment_delivery_counters_CT(core, dlv);
+        dlv->link = 0;
+
+        //
         // Now the undelivered-list reference
         //
         qdr_delivery_decref_CT(core, dlv, "qdr_link_cleanup_deliveries_CT - remove from undelivered
list");
@@ -744,6 +750,12 @@ static void qdr_link_cleanup_deliveries_CT(qdr_core_t *core, qdr_connection_t
*c
         }
 
         //
+        // Updates global and link level delivery counters like presettled_deliveries, accepted_deliveries,
released_deliveries etc
+        //
+        qdr_increment_delivery_counters_CT(core, dlv);
+        dlv->link = 0;
+
+        //
         // Now the unsettled-list reference
         //
         qdr_delivery_decref_CT(core, dlv, "qdr_link_cleanup_deliveries_CT - remove from unsettled
list");
@@ -769,6 +781,12 @@ static void qdr_link_cleanup_deliveries_CT(qdr_core_t *core, qdr_connection_t
*c
             peer = next_peer;
         }
 
+        //
+        // Updates global and link level delivery counters like presettled_deliveries, accepted_deliveries,
released_deliveries etc
+        //
+        qdr_increment_delivery_counters_CT(core, dlv);
+        dlv->link = 0;
+
         // This decref is for the removing the delivery from the settled list
         qdr_delivery_decref_CT(core, dlv, "qdr_link_cleanup_deliveries_CT - remove from settled
list");
         dlv = DEQ_HEAD(settled);
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index 6ddaff1..ba5f790 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -930,6 +930,11 @@ qdr_delivery_t *qdr_delivery_first_peer_CT(qdr_delivery_t *dlv);
 qdr_delivery_t *qdr_delivery_next_peer_CT(qdr_delivery_t *dlv);
 
 
+/**
+ * Updates global and link level delivery counters like presettled_deliveries, accepted_deliveries,
released_deliveries etc.
+*/
+void qdr_increment_delivery_counters_CT(qdr_core_t *core, qdr_delivery_t *delivery);
+
 void qdr_agent_enqueue_response_CT(qdr_core_t *core, qdr_query_t *query);
 
 void qdr_post_mobile_added_CT(qdr_core_t *core, const char *address_hash, qd_address_treatment_t
treatment);
diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index 2c0fe43..08b6cde 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -414,6 +414,7 @@ void qdr_delivery_decref(qdr_core_t *core, qdr_delivery_t *delivery, const
char
         //
         qdr_action_t *action = qdr_action(qdr_delete_delivery_CT, "delete_delivery");
         action->args.delivery.delivery = delivery;
+        action->label = label;
         qdr_action_enqueue(core, action);
     }
 }
@@ -549,32 +550,9 @@ bool qdr_delivery_settled_CT(qdr_core_t *core, qdr_delivery_t *dlv)
     return moved;
 }
 
-
-static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *delivery)
+void qdr_increment_delivery_counters_CT(qdr_core_t *core, qdr_delivery_t *delivery)
 {
-    assert(sys_atomic_get(&delivery->ref_count) == 0);
     qdr_link_t *link = delivery->link;
-
-    if (delivery->msg || delivery->to_addr) {
-        qdr_delivery_cleanup_t *cleanup = new_qdr_delivery_cleanup_t();
-
-        DEQ_ITEM_INIT(cleanup);
-        cleanup->msg  = delivery->msg;
-        cleanup->iter = delivery->to_addr;
-
-        DEQ_INSERT_TAIL(core->delivery_cleanup_list, cleanup);
-    }
-
-    if (delivery->tracking_addr) {
-        delivery->tracking_addr->outstanding_deliveries[delivery->tracking_addr_bit]--;
-        delivery->tracking_addr->tracked_deliveries--;
-
-        if (delivery->tracking_addr->tracked_deliveries == 0)
-            qdr_check_addr_CT(core, delivery->tracking_addr);
-
-        delivery->tracking_addr = 0;
-    }
-
     if (link) {
         if (delivery->presettled) {
             link->presettled_deliveries++;
@@ -603,7 +581,36 @@ static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t
*de
         }
 
         if (qd_bitmask_valid_bit_value(delivery->ingress_index) && link->ingress_histogram)
-            link->ingress_histogram[delivery->ingress_index]++;    }
+            link->ingress_histogram[delivery->ingress_index]++;
+    }
+}
+
+
+static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *delivery)
+{
+    assert(sys_atomic_get(&delivery->ref_count) == 0);
+
+    if (delivery->msg || delivery->to_addr) {
+        qdr_delivery_cleanup_t *cleanup = new_qdr_delivery_cleanup_t();
+
+        DEQ_ITEM_INIT(cleanup);
+        cleanup->msg  = delivery->msg;
+        cleanup->iter = delivery->to_addr;
+
+        DEQ_INSERT_TAIL(core->delivery_cleanup_list, cleanup);
+    }
+
+    if (delivery->tracking_addr) {
+        delivery->tracking_addr->outstanding_deliveries[delivery->tracking_addr_bit]--;
+        delivery->tracking_addr->tracked_deliveries--;
+
+        if (delivery->tracking_addr->tracked_deliveries == 0)
+            qdr_check_addr_CT(core, delivery->tracking_addr);
+
+        delivery->tracking_addr = 0;
+    }
+
+    qdr_increment_delivery_counters_CT(core, delivery);
 
     //
     // Free all the peer qdr_delivery_ref_t references


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message