allthingssecurity opened a new pull request, #29896:
URL: https://github.com/apache/camel/pull/29896

   # Description
   
   [CAMEL-26905](https://issues.apache.org/jira/browse/CAMEL-26905)
   
   Follow-up of #29525 (CAMEL-26741) and #29665 (CAMEL-26824), the last item of 
the list asked for in the review of #29525. The tasks of `MulticastProcessor` 
caught only exceptions where they aggregate (`aggregateCompleted`, `timeout`) 
and where they take the next part (`run` of `MulticastReactiveTask` and 
`MulticastTransactedTask`). An `Error` that is not a `VirtualMachineError` (an 
`AssertionError` of an `AggregationStrategy`, also of its `timeout`, or of the 
iterator of a streaming split) escaped from the task: it reached the caller 
without the error handler and the exchange stayed inflight until the 
CamelContext stopped, or, with `parallelProcessing` or from the timeout, it was 
lost on a thread of the pool and the caller got no answer. Only a `split`, 
`multicast` or `recipientList` with `synchronous=true` and without 
`parallelProcessing` already failed the exchange, through the catch around its 
await manager (#29665), and so did a transacted exchange without 
`parallelProcessing`,
  through the catch of the transacted step around the EIP (#29668).
   
   Change: these catches leave a `VirtualMachineError` as before and fail the 
exchange with any other `Throwable`, through `doFailed` as for an exception (it 
does the done work and calls the callback once, guarded by the task's `done` 
flag). `doFailed(Throwable)` and `doTimeoutFailed(Throwable)` are added next to 
the methods that take an `Exception`; an exception still goes through those 
(caught first), so a subclass that overrides them sees the same calls. An 
`Error` thrown after the task is done is now logged at WARN (an exception stays 
at DEBUG): before, it reached the thread.
   
   Docs: in the 4.24 upgrade guide entry of CAMEL-26741, the paragraph of 
CAMEL-26824 now names the aggregation strategy in every mode (also its 
`timeout`) and the iterator of a streaming split, and says what happened 
before, and the cases where the exchange did not stay inflight before (one 
paragraph, not a second one). The "An Error thrown by a processor" section of 
`error-handler.adoc` names them too (instead of "with `synchronous=true` and 
without `parallelProcessing`"), and its `VirtualMachineError` row says that the 
task throws such an `Error` on without calling the callback unless the EIP is 
synchronous or the exchange transacted (without `parallelProcessing`). The 
comment of 
`SiblingProcessorsThrowErrorTest.synchronousSplitFailsTheExchangeWithAnErrorOfItsAggregationStrategy`
 (#29665) said that the task catches only exceptions; it now says that the task 
fails the exchange.
   
   Not changed (follow-up JIRA I will file, drafted): user code in the 
multicast family that still catches only `Exception`: the `onPrepare` processor 
(an `Error` there now fails the whole exchange through the catches above, where 
an exception fails only the part), an `Error` that gets out of the step of a 
part in the transacted task (a plain `Processor`'s `Error` is handled by its 
step already, see the control test; one that escapes it, such as from an 
advice, now fails the whole split where an exception fails only the part), and 
the worker of the reactive executor (`doRun`, `executeFromQueue`), which these 
catches no longer let the `Error` of a strategy or an iterator reach.
   
   Tests, new `MulticastTaskThrowsErrorTest` (camel-core; each case sends with 
a 10 second bound, checks that the exchange failed with the `AssertionError`, 
that nothing stays inflight, and that the exchange completed once (one 
completed or failed event)):
   - an `AggregationStrategy` that throws an `AssertionError` in a `split`, a 
`split` with `parallelProcessing()` and a `multicast`;
   - the `timeout` of the strategy throws, in a parallel `split` with 
`timeout(100)` whose second part still waits;
   - an iterator that throws an `AssertionError` in a `split` with 
`streaming()`, with `streaming().parallelProcessing()`, and with a transacted 
exchange (this one passes on main too: the transacted step around the split, 
#29668, catches the `Error` when the task does not);
   - a control: a plain `Processor` that throws an `AssertionError` in a 
transacted `split` (its step handles it already, #29525; passes before the 
change too).
   
   On main the six non-transacted `Error` cases fail: three throw the `Error` 
to the caller and leave the exchange inflight, three (parallel strategy, 
parallel streaming iterator, timeout) do not complete within 10 seconds. With 
the change they pass; the split, multicast and recipient list tests of 
camel-core pass (539 run, 0 failures, 4 skipped), 20 runs in one JVM of the new 
test with `SiblingProcessorsThrowErrorTest` pass (360/360), and so do the 
camel-core tests (9224 run, 0 failures; 11 errors, all 
`DumpModelAsYaml*`/`DumpModel*` tests that fail with `NoClassDefFoundError: 
OgnlExpression` from a stale camel-yaml-io jar in my local repository, 
unrelated).
   
   The watermark expression of a split is fixed in #29792 (CAMEL-26888).
   
   # 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): 
[CAMEL-26905](https://issues.apache.org/jira/browse/CAMEL-26905).
   
   # 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.
     (I built the core modules with the formatter and import-sort plugins and 
ran the camel-core tests. I did not run the full root build.)
   
   # 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.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to