I am getting "The session lock was lost. Request a new session receiver" error.

Vaishnav AV-FT 81 Reputation points
2023-02-06T12:36:13.13+00:00

Hi,

I am getting "The session lock was lost. Request a new session receiver" error when my program runs to pick data from a session enabled service bus queue with lock duration 1 min and batch operation enabled with message ordering enforced.

Can anyone please help me understand this and tell me how I can resolve the issue.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
553 questions
Azure ISV (Independent Software Vendors) and Startups
Azure ISV (Independent Software Vendors) and Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.ISV (Independent Software Vendors) and Startups: A Microsoft program that helps customers adopt Microsoft Cloud solutions and drive user adoption.
89 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnuragSingh-MSFT 20,431 Reputation points
    2023-02-10T05:15:26.6733333+00:00

    Vaishnav AV-FT, thank you for posting this question. As the error mentions, it seems that the lock acquired by the receiver was lost. To overcome this issue, a good option would be to use ServiceBusSessionProcessor which can be created with ServiceBusSessionProcessorOptions.MaxAutoLockRenewalDuration Property enabling the session locks to be renewed automatically.

    The following link has a sample for ServiceBusSessionProcessor - Using the session processor

    Please let me know if you have any questions.

    1 person found this answer helpful.
    0 comments No comments