Closed highbrowansala closed 4 years ago
The issue was not with the QueueClient
object per se. It was with the processes that we were triggering from within the MessageHandler
: processDB1(customObject)
and processDB2(customObject)
. since these processes were not optimized, the message consumption dropped and the locks gor expired (in peek-lock mode), as the handler was spending more time (in relation to the rate at which messages were published to the queues) in completing these opertations.
After optimizing the processes, the consumption and completion (in peek-lock) mode were just fine.
Hello everyone,
Background
We have a data transfer solution with Azure Service Bus as the message broker. We are transferring data from
x
datasets throughx
queues - withx
dedicatedQueueClient
s as senders. Some senders publish messages at the rate of one message every two seconds, while others publish one every 15 minutes.The application on the data source side (where senders are) is working just fine, giving us the desired throughput.
On the other side, we have an application with one QueueClient receiver per queue with the following configuration:
maxConcurrentCalls
=1
autoComplete
=true
(if receive mode =RECEIVEANDDELETE
) andfalse
(if receive mode =PEEKLOCK
) - we have some receivers where, if they shut-down unexpectedly, would want to preserve the messages in the Service Bus Queue.maxAutoRenewDuration
=3
minutes (lock duraition on all queues =30
seconds)The
MessageHandler
registered with each of these receivers does the following:We tested with the following scenarios:
Scenario 1 - receive mode =
RECEIVEANDDELETE
, message publish rate:30/ minute
Expected Behavior
The messages should be received continuosuly with a constant throughput (which need not necessarily be the throughput at source, where messages are published).
Actual behavior
We observe random, long periods of inactivity from the QueueClient - ranging from minutes to hours - there is no Outgoing Messages from the Service Bus namespace (observed on the Metrics charts) and there are no consumption logs for the same time periods!
Scenario 2 - receive mode =
PEEKLOCK
, message publish rate:30/ minute
Expected Behavior
The messages should be received continuosuly with a constant throughput (which need not necessarily be the throughput at source, where messages are published).
Actual behavior
We keep seeing
MessageLockLostException
constantly after 20-30 minutes into the run of the application.We tried doing the following -
0
in one test cycle), to reduce the no. of messages that are locked for the clientmaxAutoRenewDuration
to 5 minutes - ourprocessDB1()
andprocessDB2()
do not take more than a second or two for almost 90% of the cases - so, I think the lock duration of 30 seconds andmaxAutoRenewDuration
are not issues here.CompletableFuture.get()
and made the processing synchronous.None of these tweaks helped us fix the issue. What we observed is that the
COMPLETE
orRENEWMESSAGELOCK
are throwing theMessageLockLostException
.We need help with finding answers for the following:
QueueClient
in scenario 1?MessageLockLostException
s are thrown, because the locks have indeed expired? we suspect the locks cannot expire too soon, as our processing happens in a second or two. disabling prefetch also did not solve this for us.Versions and Service Bus details
Java -
openjdk-11-jre
Azure Service Bus namespace:sbrps-geoshield-qa
(tier:Standard
) Entity:5d639f10-c4de-11ea-87d0-0242ac130003_avl_currentpositions
testing time window: 2020-07-20 10:30 PM till 2020-07-21 8:30 AM (IST - UTC + 5:30) Java SDK version -3.4.0