You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2019/12/14 02:57:48 UTC
[qpid-dispatch] branch master updated: DISPATCH-1523: dereferencd
link before decref of delivery
This is an automated email from the ASF dual-hosted git repository.
chug 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 ca1bbf6 DISPATCH-1523: dereferencd link before decref of delivery
ca1bbf6 is described below
commit ca1bbf633d1361ddbcc8fcd0b6395a582f3e561f
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Fri Dec 13 21:54:51 2019 -0500
DISPATCH-1523: dereferencd link before decref of delivery
Prevent delivery from being deleted before link references are complete.
---
src/router_core/delivery.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/router_core/delivery.c b/src/router_core/delivery.c
index 5ba112f..6d98673 100644
--- a/src/router_core/delivery.c
+++ b/src/router_core/delivery.c
@@ -127,16 +127,17 @@ bool qdr_delivery_is_aborted(const qdr_delivery_t *delivery)
void qdr_delivery_decref(qdr_core_t *core, qdr_delivery_t *delivery, const char *label)
{
- uint32_t ref_count = sys_atomic_dec(&delivery->ref_count);
- assert(ref_count > 0);
-
+ // Grab the link identity if the link is still active
qdr_link_t *link = qdr_delivery_link(delivery);
+ uint64_t link_identity = link ? link->identity : 0;
- qd_log(core->log, QD_LOG_DEBUG, "Delivery decref: dlv:%lx rc:%"PRIu32" link:%"PRIu64" %s", (long) delivery, ref_count - 1, link ? link->identity : 0, label);
+ uint32_t ref_count = sys_atomic_dec(&delivery->ref_count);
+ assert(ref_count > 0);
+ qd_log(core->log, QD_LOG_DEBUG, "Delivery decref: dlv:%lx rc:%"PRIu32" link:%"PRIu64" %s", (long) delivery, ref_count - 1, link_identity, label);
if (ref_count == 1) {
- //
+ // The ref_count was 1 and now it is zero. We are deleting the last ref.
// The delivery deletion must occur inside the core thread.
// Queue up an action to do the work.
//
@@ -600,14 +601,15 @@ qdr_delivery_t *qdr_delivery_next_peer_CT(qdr_delivery_t *dlv)
void qdr_delivery_decref_CT(qdr_core_t *core, qdr_delivery_t *dlv, const char *label)
{
- uint32_t ref_count = sys_atomic_dec(&dlv->ref_count);
-
+ // Grab the link identity if the link is still active
qdr_link_t *link = qdr_delivery_link(dlv);
+ uint64_t link_identity = link ? link->identity : 0;
- qd_log(core->log, QD_LOG_DEBUG, "Delivery decref_CT: dlv:%lx rc:%"PRIu32" link:%"PRIu64" %s", (long) dlv, ref_count - 1, link ? link->identity : 0, label);
-
+ uint32_t ref_count = sys_atomic_dec(&dlv->ref_count);
assert(ref_count > 0);
+ qd_log(core->log, QD_LOG_DEBUG, "Delivery decref_CT: dlv:%lx rc:%"PRIu32" link:%"PRIu64" %s", (long) dlv, ref_count - 1, link_identity, label);
+
if (ref_count == 1)
qdr_delete_delivery_internal_CT(core, dlv);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org