Azure / azure-functions-servicebus-extension

Service Bus extension for Azure Functions
MIT License
65 stars 36 forks source link

MaxAutoRenewDuration is not working properly in session based servicebus queue trigger azure function #153

Closed sivakumar715 closed 2 years ago

sivakumar715 commented 3 years ago

We have deployed session based servicebus trigger azure function under kubernetes service(AKS) with below configuration(attached host.json & message lock duration).

message lock duration = 5 minutes maxAutoRenewDuration (in host.json) - 4 minutes

image image

My azure function handles a log running process which takes more than 30 minutes to complete. Problem: Azure function failed with 'SessionLockLostException' error and retried the same message multiple times until function response time is less than 5 mins.

Exception: Microsoft.Azure.ServiceBus.SessionLockLostException: at Microsoft.Azure.ServiceBus.Core.MessageReceiver+ DisposeMessagesAsync d101.MoveNext (Microsoft.Azure.ServiceBus, Version=4.2.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.Azure.ServiceBus.RetryPolicy+ RunOperation d19.MoveNext (Microsoft.Azure.ServiceBus, Version=4.2.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c)

I'm expecting azure function should complete in one attempt by taking advantage of auto renew the lock(maxAutoRenewDuration ). please help us if anyone have solution for this issue.

v-anvari commented 3 years ago

Hi @sivakumar715 , Can you let us know what is the version of "Microsoft.Azure.WebJobs.Extensions.ServiceBus" used. There is a similar exception seen here: azure-functions-servicebus-extension/issues/23.

Transferring this issue to service bus extension for further updates

v-anvari commented 3 years ago

cc - @alrod

sivakumar715 commented 3 years ago

Hi @sivakumar715 , Can you let us know what is the version of "Microsoft.Azure.WebJobs.Extensions.ServiceBus" used. There is a similar exception seen here: azure-functions-servicebus-extension/issues/23.

Transferring this issue to service bus extension for further updates

sivakumar715 commented 3 years ago

Hi @v-anvari, I'm using 4.2.1 version for Microsoft.Azure.WebJobs.Extensions.ServiceBus. please let us know if any update.

v-anvari commented 3 years ago

Hi @sivakumar715 , Thank you for the details.

Tagging @alrod , for further investigation

saikiran-karanam commented 3 years ago

We are also facing the exact issue. We are also using KEDA and session based queues. @sivakumar715, Were you able to fix this issue? If yes can you pls share the fix/workaround. @alrod were you able to identify the reason for this behaviour?

alrod commented 2 years ago

sivakumar715, saikiran-karanam do you still have the issue?

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.