-
Couldn't load subscription status.
- Fork 5.1k
Description
Library name and version
Azure.Messaging.ServiceBus 7.17.5
Query/Question
Our application is written in C# and we're using the ServiceBusSessionProcessor to receive messages from a Queue. Note that we're also using sessions here.
We ran in to an issue the other day in production when the processing of one of our messages was taking a longer time then usual. The processing of the message was taking well over 6 minutes. We don't "complete" the message until processing of the message has completed.
While processing the message I could see (via logs) that after exactly 6 minutes, Service Bus would redeliver the same message again. This duplicate processing of the same message occurred 10 times. We would receive a message and after exactly 6 minutes of processing, Service Bus would redeliver the same message.
Typically message processing does not take this long but we were having a separate issue with a downstream service which was causing this extended processing time.
I also want to mention that I'm manually renewing the session lock using a periodic timer. I use the SessionLockedUntil property of the ProcessSessionMessageEventArgs in order to set the period of the periodic timer. The value I use as the period is SessionLockedUntil - 10seconds. If the expression evaluates to a TimeSpan that's less then zero I abandon the message and call ReleaseSession. When the periodic timer executes I call RenewSessiongLockAsync. That being said nothing in the logs indicates that this occurred, just adding some additional context.
I'm trying to understand what 6 minute timeout I'm hitting here. I see in the logs that the session lock is being renewed ~ every LockDuration - 10 seconds but I'm still hitting this 6 minute timeout. I'm also not seeing any exceptions in the logs.
What timeout is this? What can I check in either the Azure portal or the SDK to determine what timeout this is?
I do plan on swapping the manual session lock renewal for automatic session lock renewal via MaxAutoLockRenewalDuration but I'm unsure if session lock expiry is the issue here.
I should also mention that all durations are set to their default values (They've never been altered).
Environment
No response