Skip to content

Commit 5a4fce4

Browse files
committed
Fix[mqbblp::Domain::registerQueue]: logging d_queues.size() without mutex
`Domain::registerQueue` logs `d_queues.size()` without holding a mutex. Fixed by storing size for logging under the mutex. Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
1 parent 008e5f5 commit 5a4fce4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/groups/mqb/mqbblp/mqbblp_domain.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ int Domain::registerQueue(const bsl::shared_ptr<mqbi::Queue>& queueSp)
577577
// invoke 'Queue.configure' outside of the lock scope, and in case it
578578
// fails, we rollback.
579579

580+
size_t count = 0;
581+
580582
{
581583
bslmt::LockGuard<bslmt::Mutex> guard(&d_mutex); // LOCK
582584

@@ -597,20 +599,22 @@ int Domain::registerQueue(const bsl::shared_ptr<mqbi::Queue>& queueSp)
597599
d_queues[queueSp->uri().queue()] = queueSp;
598600

599601
d_numQueues.add(1);
602+
603+
count = d_queues.size();
600604
}
601605

602606
BALL_LOG_INFO << "Registered queue to domain '" << d_name << "' "
603607
<< "[canonicalURI: " << queueSp->uri().canonical()
604608
<< ", qId: " << bmqp::QueueId::QueueIdInt(queueSp->id())
605609
<< "]. Total number of registered queues in the domain: "
606-
<< d_queues.size() << ".";
610+
<< count << ".";
607611

608612
return rc_SUCCESS;
609613
}
610614

611615
void Domain::unregisterQueue(mqbi::Queue* queue)
612616
{
613-
// executed by the associated CLUSTER's DISPATCHER thread
617+
// Thread: CLUSTER DISPATCHER
614618

615619
// PRECONDITIONS
616620
BSLS_ASSERT_SAFE(d_cluster_sp->inDispatcherThread());

0 commit comments

Comments
 (0)