Skip to content

lock supplied is invalid #440

@cristibozga

Description

@cristibozga

We are migration from the old servicebus sdk to the new one and after the first deployment we had several errors.
One of the problems is:

"{\"az.sdk.message\":\"The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. For more information please see https://aka.ms/ServiceBusExceptions . Reference:249d89d2-7020-4ded-8d63-f7d6d1ad5a5e, TrackingId:bab4ac2000007d9111c2b9d16771f07d_G42_B7, SystemTracker:gi::G42:-1773474619:EsbPrebookingCancelledQueue_90b47a_1735520375306, bi::in-connection14043(G42-319093)::session14047::link297974225, Timestamp:2024-12-31T03:48:41, errorContext[NAMESPACE: sbus-rnd-regression-main-tjkgat.servicebus.windows.net. ERROR CONTEXT: N/A, PATH: EsbPrebookingCancelledQueue, REFERENCE_ID: EsbPrebookingCancelledQueue_90b47a_1735520375306, LINK_CREDIT: 8]\",\"exception\":\"The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. For more information please see https://aka.ms/ServiceBusExceptions . Reference:249d89d2-7020-4ded-8d63-f7d6d1ad5a5e, TrackingId:bab4ac2000007d9111c2b9d16771f07d_G42_B7, SystemTracker:gi::G42:-1773474619:EsbPrebookingCancelledQueue_90b47a_1735520375306, bi::in-connection14043(G42-319093)::session14047::link297974225, Timestamp:2024-12-31T03:48:41, errorContext[NAMESPACE: sbus-rnd-regression-main-tjkgat.servicebus.windows.net. ERROR CONTEXT: N/A, PATH: EsbPrebookingCancelledQueue, REFERENCE_ID: EsbPrebookingCancelledQueue_90b47a_1735520375306, LINK_CREDIT: 8]\",\"connectionId\":\"MF_1fc332_1735520375306\"}

I see the problems appeared on the same queue 5 times in an interval of 20 seconds on a non-session queue.
The code to create the consumer:

private ServiceBusProcessorClient createQueueConsumer(String queuePath, QueueListenerProperties queueListenerProperties) {

     ServiceBusClientBuilder.ServiceBusProcessorClientBuilder builder = new ServiceBusClientBuilder()
             .connectionString(serviceBusProperties.getConnectionString())
             .retryOptions(retryOptions(queueListenerProperties))
             .processor()
             .maxConcurrentCalls(queueListenerProperties.getMaxConcurrentCalls())
             .queueName(queuePath);
     builder.processMessage(messageHandler);
     builder.processError(errorHandler);
     return builder.buildProcessorClient();
 }

 private static AmqpRetryOptions retryOptions(QueueListenerProperties properties) {
     AmqpRetryOptions o = new AmqpRetryOptions();
     o.setTryTimeout(Duration.ofMillis(properties.getTimeout()));
     o.setMode(AmqpRetryMode.FIXED);
     return o;
 }
}

Timeout= 3 sec.
I also see that the queue has now a dead-letter message. i don't know if it is directly related to this problem.

Can you, please, tell us how can we avoid this problem?

SDK version 7.17.7
java version: 17

Thank you,
Cristi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions