shashank created CAMEL-27319:
--------------------------------

             Summary: camel-core - Throttle EIP: after the throttler was idle, 
a message without the limit header fails instead of using the old value
                 Key: CAMEL-27319
                 URL: https://issues.apache.org/jira/browse/CAMEL-27319
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: shashank
            Assignee: shashank


h3. What happens

throttle-eip.adoc says that when the limit comes from a header and the header 
is absent, "the Throttler uses the old value" ({{ThrottlerNullEvalTest}}). The 
old value is kept in the throttling state of the key, which both throttlers 
remove when it was not used for a while ({{ConcurrentRequestsThrottler}}: 10 
seconds after the last permit was returned; {{TotalRequestsThrottler}}, the 
default mode: about 10 time periods). The next exchange gets a new state with 
no limit, and without the header it fails with {{RuntimeExchangeException: The 
maxConcurrentRequestsExpression was evaluated as null}} (or 
{{maxRequestsPerPeriodExpression}}).

So the route of the docs, {{throttle(header("throttleValue"))}}, fails its 
first message without the header after it was idle for 10 seconds (or 10 
periods).

h3. How to reproduce

{{ThrottlerCleanKeepsLimitTest}} (camel-core, both modes): send a message with 
the limit 3, run the clean task, send a message without the header: it fails.

Found with a TLA+ model of the throttler state cleanup.

h3. Fix

Without a correlation expression, the throttler keeps the last limit the 
expression gave, and a new state uses it when the expression gives none. With a 
correlation expression nothing changes (keeping a limit per key would keep an 
entry for every key).

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to