From 4c73d21d3bd20a55421c8be3695f4e01e2cfd3e2 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Wed, 30 Sep 2020 19:43:16 -0700 Subject: [PATCH] Fixed deadlock in DLQ ack processing --- pulsar/dlq_router.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pulsar/dlq_router.go b/pulsar/dlq_router.go index 68b263bbcb..6aa7e2b69c 100644 --- a/pulsar/dlq_router.go +++ b/pulsar/dlq_router.go @@ -101,7 +101,11 @@ func (r *dlqRouter) run() { ReplicationClusters: msg.replicationClusters, }, func(MessageID, *ProducerMessage, error) { r.log.WithField("msgID", msgID).Debug("Sent message to DLQ") - cm.Consumer.AckID(msgID) + + // The Producer ack might be coming from the connection go-routine that + // is also used by the consumer. In that case we would get a dead-lock + // if we'd try to ack. + go cm.Consumer.AckID(msgID) }) case <-r.closeCh: