shashank created CAMEL-27066:
--------------------------------

             Summary: camel-azure-servicebus - the Camel lock renewer retries a 
failed renewal only on its next run, which can come after the lock expired
                 Key: CAMEL-27066
                 URL: https://issues.apache.org/jira/browse/CAMEL-27066
             Project: Camel
          Issue Type: Bug
          Components: camel-azure-servicebus
            Reporter: shashank
            Assignee: shashank


Found by the DST world of CAMEL-26956 once the CAMEL-26969 fix was on main.

h3. What happens

The {{LockRenewer}} of {{ServiceBusConsumer}} runs every 10 s (or a second 
later) and renews a message lock when it expires within two intervals. Since 
CAMEL-26969 a transient renewal error keeps the entry, so the next run tries 
again. But the next run comes about 10 s later, and by then the lock may be 
gone.

Example with a queue lock duration of 30 s (seed 113 of the world):
* t=37 s: the lock is renewed until 68.9 s.
* t=48 s: nothing to do, the lock expires later than now + 20 s.
* t=59 s: the renewal fails with a transient error.
* t=70 s: the next run renews, but the lock expired at 68.9 s. The renewal 
fails with a lost lock and the message is delivered again while the first 
exchange is still being processed.

So with a lock duration below about 40 s, one transient error is enough to lose 
the lock. In the world, 11 of 2000 seeds fail this way (all with a 30 s lock 
and a renewal fault rate of 0.05 or 0.2).

h3. Fix

Try a transient failure again soon, while the lock is still held, instead of 
waiting for the next run (a short bounded retry of the renewal), and keep the 
next run as the fallback. The world then runs with 
{{-Ddst.servicebus.strictRenew=true}} as its default, and the excuse for 
renewal faults goes away.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to