shashank created CAMEL-26908:
--------------------------------
Summary: camel-core - an Error of an on completion skips the other
on completions of the exchange and the end of its unit of work
Key: CAMEL-26908
URL: https://issues.apache.org/jira/browse/CAMEL-26908
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26741. {{UnitOfWorkHelper}} runs the on completions
({{Synchronization}}) of an exchange when its unit of work is done, and their
route aware callbacks when the exchange enters or leaves a route. It catches
{{Exception}} around each call, "to ensure all synchronizations have a chance
to run", and logs it at WARN. An {{Error}} that is not a
{{VirtualMachineError}} (such as a {{NoClassDefFoundError}} of a client
library, or an {{AssertionError}}) thrown by one of them escapes instead:
* the on completions after it do not run, such as the commit or rollback of the
consumer (the move of a file, the acknowledge of a message) or the release of a
resource;
* {{DefaultUnitOfWork.done}} stops before it removes the exchange from the
inflight registry, fires the completed or failed event and releases a pooled
exchange, and {{UnitOfWorkHelper.doneUow}} (which also catches only
{{Exception}}) lets the {{Error}} through to the caller, so the exchange stays
in the inflight registry;
* an {{Error}} of {{onBeforeRoute}} or {{onAfterRoute}} also skips the end of
the route: its inflight count (so a graceful shutdown waits for its timeout),
its route policies, and in the route that created the unit of work the unit of
work itself, so none of the on completions run.
Expected: as for an exception, the {{Error}} is logged and ignored, so the
other on completions run and the unit of work ends; a {{VirtualMachineError}}
is left as before. The same for {{onBeforeRoute}} and {{onAfterRoute}} of a
{{SynchronizationRouteAware}}, and in {{doneUow}}.
The advices of a route ({{RoutePolicyAdvice}}, {{AdviceIterator}}) have the
same gap and are covered by their own JIRA (link it when filed).
Found while going through the follow-ups of CAMEL-26741; confirmed with tests
on the real classes.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)