azure-service-bus-java icon indicating copy to clipboard operation
azure-service-bus-java copied to clipboard

Service Bus Throwing Timeout , Message Lock Lost And Illegal Argument Exception

Open KrishCR97 opened this issue 6 years ago • 6 comments

Actual Behavior

App Server was able to read the messages from the topic but when acknowledging to the server that it has successfully processed then service bus throws the following exceptions :

  1. com.microsoft.azure.servicebus.primitives.TimeoutException Stack Trace : com.microsoft.azure.servicebus.primitives.TimeoutException: at com.microsoft.azure.servicebus.primitives.CoreMessageReceiver$1.run (CoreMessageReceiver.java162) at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java511) at java.util.concurrent.FutureTask.runAndReset (FutureTask.java308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301 (ScheduledThreadPoolExecutor.java180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java294) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java624) at java.lang.Thread.run (Thread.java748)

  2. com.microsoft.azure.servicebus.primitives.MessageLockLostException Stack Trace :com.microsoft.azure.servicebus.primitives.MessageLockLostException: at com.microsoft.azure.servicebus.primitives.ExceptionUtil.toException (ExceptionUtil.java102) at com.microsoft.azure.servicebus.primitives.RequestResponseUtils.generateExceptionFromError (RequestResponseUtils.java97) at com.microsoft.azure.servicebus.primitives.RequestResponseUtils.genereateExceptionFromResponse (RequestResponseUtils.java92) at com.microsoft.azure.servicebus.primitives.CoreMessageReceiver.lambda$null$12 (CoreMessageReceiver.java1293) at java.util.concurrent.CompletableFuture.uniCompose (CompletableFuture.java952) at java.util.concurrent.CompletableFuture$UniCompose.tryFire (CompletableFuture.java926) at java.util.concurrent.CompletableFuture$Completion.run (CompletableFuture.java442) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java624) at java.lang.Thread.run (Thread.java748) 3.com.microsoft.azure.servicebus.primitives.CoreMessageReceiver.generateDeliveryNotFoundException(java.lang.IllegalArgumentException) Stack Trace : java.lang.IllegalArgumentException: at com.microsoft.azure.servicebus.primitives.CoreMessageReceiver.generateDeliveryNotFoundException (CoreMessageReceiver.java1252) at com.microsoft.azure.servicebus.primitives.CoreMessageReceiver.updateMessageStateAsync (CoreMessageReceiver.java1108) at com.microsoft.azure.servicebus.primitives.CoreMessageReceiver.completeMessageAsync (CoreMessageReceiver.java1030) at com.microsoft.azure.servicebus.MessageReceiver.lambda$completeAsync$7 (MessageReceiver.java236) at java.util.concurrent.CompletableFuture.uniComposeStage (CompletableFuture.java981) at java.util.concurrent.CompletableFuture.thenCompose (CompletableFuture.java2124) at com.microsoft.azure.servicebus.MessageReceiver.completeAsync (MessageReceiver.java232) at com.microsoft.azure.servicebus.MessageAndSessionPump.completeAsync (MessageAndSessionPump.java696) at com.microsoft.azure.servicebus.SubscriptionClient.completeAsync (SubscriptionClient.java251) at com.sams.credit.sync.subscribers.BaseCreditSBTopicSubscriber.onMessageAsync (BaseCreditSBTopicSubscriber.java105) at com.microsoft.azure.servicebus.MessageAndSessionPump.lambda$null$0 (MessageAndSessionPump.java180) at java.util.concurrent.CompletableFuture.uniCompose (CompletableFuture.java952) at java.util.concurrent.CompletableFuture$UniCompose.tryFire (CompletableFuture.java926) at java.util.concurrent.CompletableFuture$Completion.exec (CompletableFuture.java443) at java.util.concurrent.ForkJoinTask.doExec (ForkJoinTask.java289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask (ForkJoinPool.java1056) at java.util.concurrent.ForkJoinPool.runWorker (ForkJoinPool.java1692) at java.util.concurrent.ForkJoinWorkerThread.run (ForkJoinWorkerThread.java157)

##Use-Case We have an app server which listens to the messages from service bus. The messages were pushed via function app to Service Bus if there are any changes made to a particular collection in CosmosDB.

The app was able to receive messages from service bus but when the app server acknowledges service bus explorer then service bus is throwing the above errors.

Service Bus version - 1.2.14

KrishCR97 avatar Sep 26 '19 22:09 KrishCR97

Just pasting exception stack traces don't help. We need your use case and the sample application code and when and how you are hitting exceptions.

yvgopal avatar Oct 02 '19 21:10 yvgopal

Hello @yvgopal the customer updated their original post here and did not post a reply. So I am mentioning you here.

Sanitys avatar Oct 10 '19 16:10 Sanitys

How often do you see these exceptions? If you rarely see them, it is likely errors coming from the service when updates are being applied on the service. But it doesn't happen every day or every week.

Otherwise, MessageLockLostException means you received a message and didn't complete it until its lock expired. What is the LockDuration property on your queue or subscription? Try increasing the LockDuration if these exceptions persist.

yvgopal avatar Oct 11 '19 22:10 yvgopal

@yvgopal We see the exceptions mentioned above more frequently. As of now timeout is about 1 minute. Our app take around 1 - 2 sec to process a message.

KrishCR97 avatar Oct 23 '19 19:10 KrishCR97

It is almost always a service side issue. If it persists, please raise a support ticket.

yvgopal avatar Oct 23 '19 19:10 yvgopal

@yvgopal we are working with @KrishCR97 via a support case now.

jcbrooks92 avatar Oct 24 '19 13:10 jcbrooks92