You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/08/28 11:56:00 UTC
[jira] [Updated] (CAMEL-24267) ThrottlingInflightRoutePolicy.setResumePercentOfMax has writer-side race condition
[ https://issues.apache.org/jira/browse/CAMEL-24267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-24267:
--------------------------------
Fix Version/s: 4.22.0
> ThrottlingInflightRoutePolicy.setResumePercentOfMax has writer-side race condition
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-24267
> URL: https://issues.apache.org/jira/browse/CAMEL-24267
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Guillaume Nodet
> Assignee: Guillaume Nodet
> Priority: Major
> Labels: good-first-issue
> Fix For: 4.22.0
>
>
> Found during review of PR #24985 (CAMEL-24227: volatile sweep for JMX-writable fields). The PR introduced {{ThrottlingLimits}} immutable holder records to fix *reader-side* tearing, but *writer-side* atomicity remains unaddressed.
> h3. Problem
> {{setResumePercentOfMax(int)}} reads {{this.maxInflightExchanges}} to compute the resume value, then publishes a new {{ThrottlingLimits}} holder. Two concurrent JMX writers calling {{setResumePercentOfMax}} and {{setMaxInflightExchanges}} simultaneously can each read the other's stale value, producing a holder built from a mixed snapshot.
> {code:java}
> public void setResumePercentOfMax(int resumePercentOfMax) {
> this.resumePercentOfMax = resumePercentOfMax;
> // reads maxInflightExchanges — but another writer may be changing it concurrently
> int resume = (int) (maxInflightExchanges * resumePercentOfMax / 100.0);
> this.throttlingLimits = new ThrottlingLimits(maxInflightExchanges, resume);
> }
> {code}
> h3. Suggested fix
> Synchronize the writer methods, or use a compare-and-swap loop on the volatile holder reference to ensure the snapshot is consistent.
> h3. References
> * PR [#24985|https://github.com/apache/camel/pull/24985] review comment by oscerd
> * {{core/camel-core-processor/src/main/java/org/apache/camel/processor/ThrottlingInflightRoutePolicy.java}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)