azure-sdk-for-net: Unable to receive deferred dead-letter from session-enabled queue
I’ve a session-enabled queue with a message in DLQ and the state of the message is “Deferred”. I use the “ReceiveDeferredMessageAsync()” method to receive the message but it fails with the exception “Azure.Messaging.ServiceBus.ServiceBusException: 'The session lock has expired on the MessageSession. Accept a new MessageSession.”.
I don’t think session locks are required for DLQ. Kindly suggest.
Here’s the repro step:
C#
var serviceBusClient = new ServiceBusClient("<connectionstring>");
var serviceBusReceiver = serviceBusClient.CreateReceiver("<queue>", new ServiceBusReceiverOptions
{
ReceiveMode = ServiceBusReceiveMode.PeekLock,
SubQueue = SubQueue.DeadLetter
});
var message = await serviceBusReceiver.ReceiveDeferredMessageAsync(<sequence number>);
Exception:
Azure.Messaging.ServiceBus.ServiceBusException: ‘The session lock has expired on the MessageSession. Accept a new MessageSession. TrackingId:8d745660-ceed-4806-9c39-8bd2b0c63875_B3, SystemTracker:NoSystemTracker, Timestamp:2023-03-02T06:47:29 (SessionLockLost). For troubleshooting information, see https://aka.ms/azsdk/net/servicebus/exceptions/troubleshoot.’
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20 (10 by maintainers)
The service team is looking into this.
I was able to reproduce the issue when using a separate receiver/client as you mentioned when attempting the final receive:
I’ll need to reach out to the service team to find out why this is happening.