Azure / Azure/azure-service-bus-java

lock supplied is invalid

Open
#440 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
62
Forks
63
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.