ammachado opened a new pull request, #28820: URL: https://github.com/apache/camel/pull/28820
# Description [CAMEL-26476](https://issues.apache.org/jira/browse/CAMEL-26476), a possible correctness bug listed in [CAMEL-25132](https://issues.apache.org/jira/browse/CAMEL-25132), reproduced with routes on `main`. `Splitter.afterSend` read the `SplitFailureTracker` from the properties of the item exchange, which inherits them, and it did not check that this splitter has thresholds. The other three places that use the tracker have that check, with comments about a leaked outer tracker. | nesting | processed items, 2 outer items of 3 inner items each | | |---|---|---| | inner split without thresholds | 8 | it counts its items in the outer tracker | | inner split with thresholds | 0 | it removes the tracker from the outer item when it completes | This is more than a reporting problem: `errorThreshold` divides failures by processed items. In both cases the outer split did not stop when it should. With `errorThreshold(0.5)` and 3 outer items, the second failed and the third still ran. `MulticastProcessor` has a new protected `afterSend(pair, watch, original)`, which calls the existing method, so an existing override keeps working. `Splitter` overrides it, reads the tracker from `original` as `shouldContinueOnFailure` does, and has the same check as the other places. There is an upgrade guide entry, as a nested split with `errorThreshold` can now stop earlier than before. ## Tests 4 new tests in `SplitterNestedFailureTrackerLeakTest`, 2 on `SplitResult` counts and 2 on whether `errorThreshold` stops the outer split. All 4 failed before the fix. Removing the check again makes 2 fail, with 8 processed items. Verified: `camel-core`, 8676 tests, 0 failures, 44 skipped (not reviewed one by one). `GenericFileConverterTest.testToSerializable` failed once and passed on the automatic rerun. It is a file conversion test that does not use the changed code, and I did not look into it further. Component modules were not run. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. Not run from the root folder: I ran `mvn install -Dquickly -pl core/camel-core -am`, and `git status` showed only the changed files afterwards. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of Adriano Machado (@ammachado) _This was generated by an AI agent and may contain inaccuracies. Please verify before relying on it._ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
