[
https://issues.apache.org/jira/browse/CAMEL-26969?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26969 started by shashank.
----------------------------------------
> camel-azure-servicebus - the Camel lock renewer stops renewing a message lock
> after one transient renewal error
> ---------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26969
> URL: https://issues.apache.org/jira/browse/CAMEL-26969
> Project: Camel
> Issue Type: Bug
> Components: camel-azure-servicebus
> Reporter: shashank
> Assignee: shashank
> Priority: Minor
>
> Found by the Service Bus DST world of CAMEL-26956 (fork branch
> {{camel-azure-servicebus-dst-world-v2}}, PR opens with the 11-16 batch): its
> default set accepts this case, {{-Ddst.servicebus.strictRenew=true}} fails 27
> of 1000 seeds (the lock of a message is lost and the message delivered again
> while its exchange still runs). Reproduced outside the DST harness with a
> plain unit test (below).
> h3. What happens
> The lock renewer of {{ServiceBusConsumer}} (peek-lock,
> {{maxAutoLockRenewDuration}} > 0, added by CAMEL-23937) renews a lock that
> expires within the next two runs (every 10 seconds) with
> {{renewalClient.renewMessageLock(message)}}. When that call fails, the error
> callback removes the exchange from the renewer: the lock is never renewed
> again, whatever the error was. In SDK 7.17
> {{ServiceBusReceiverAsyncClient.renewMessageLock}} makes one request (no
> retry policy around it), so a single transient error, such as a busy server
> ({{ServiceBusException}} with {{isTransient() == true}}) or a connection that
> was being recovered, ends the renewal. The lock then expires while the
> exchange runs, Service Bus delivers the message again (delivery count + 1),
> and the settlement of the first exchange fails with a lost lock.
> h3. Expected
> {{ServiceBusException#isTransient}}: the error is transient and the operation
> can be retried. The processor of the Service Bus .NET SDK keeps renewing a
> message lock after a transient renewal error and stops only on another error
> ({{ReceiverManager.RenewMessageLockAsync}}: "if the error was not transient,
> break out of the loop"). The Camel renewer runs again 10 seconds later and
> renews while the lock still has time left, so it can try again on a transient
> error.
> h3. Reproduction
> New {{ServiceBusConsumerTest.lockRenewerRenewsAgainAfterATransientError}}:
> the lock expires in 15 seconds, the first renewal fails with a transient
> {{ServiceBusException}} (SERVER_BUSY), the second succeeds. On main the
> second run of the renewer does not renew (one call); expected a second
> renewal. Control {{lockRenewerStopsAfterTheLockIsLost}}: a
> {{MESSAGE_LOCK_LOST}} error (not transient) still ends the renewal.
> h3. Fix
> On a transient {{ServiceBusException}} the renewer keeps the entry (logged at
> WARN), so its next run renews again; another error removes it as before. The
> renewal still ends at {{maxAutoLockRenewDuration}}, when the exchange
> completes, or at a lost lock. Branch
> {{camel-azure-servicebus-renew-after-transient-error}}.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)