[
https://issues.apache.org/jira/browse/CAMEL-27472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153322#comment-18153322
]
Guillaume Nodet commented on CAMEL-27472:
-----------------------------------------
This issue is being investigated by a coding agent (on behalf of gnodet).
Triage findings: Bug confirmed in two files. (1) BackOffTimerTask.java
(camel-util) line 201: catch (Exception e) should catch Throwable - when a
java.lang.Error is thrown by the function, it escapes run(), is silently
absorbed by ScheduledExecutorService, and complete() is never called, so no
whenComplete callbacks fire and no further restart attempts are scheduled. (2)
DefaultSupervisingRouteController.java (camel-base-engine) line 766: catch
(Exception e) in the restart lambda also misses Error. Fix: widen both catch
clauses to Throwable (re-throwing VirtualMachineError), mark the task Failed,
and call complete() so the whenComplete handler fires. Two files, single-PR
scope.
_Note: This comment was generated by an AI coding agent and requires manual
verification._
> camel-core - Supervising route controller: an Error in a restart attempt ends
> the restarts of the route, without a log line
> ---------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27472
> URL: https://issues.apache.org/jira/browse/CAMEL-27472
> Project: Camel
> Issue Type: Sub-task
> Components: camel-core
> Reporter: Federico Mariani
> Assignee: Guillaume Nodet
> Priority: Major
>
> {{BackOffTimerTask.run()}} (camel-util) catches only {{Exception}}, and so
> does the restart function of {{DefaultSupervisingRouteController}}. An Error
> in a restart attempt, such as an {{ExceptionInInitializerError}} or a
> {{NoClassDefFoundError}} when the consumer starts and loads a class of its
> client for the first time, escapes the task, and the scheduler keeps it in a
> {{Future}} that nothing reads. No more attempts are made, and the task does
> not complete: the route is neither started nor marked exhausted, no restart
> failure event is sent, and nothing is logged. The route stays Stopped.
> Reproduced on main, with {{backOffDelay=100}} and a consumer whose first
> start throws an {{IllegalStateException}}, the second an
> {{ExceptionInInitializerError}}, and the third would succeed:
> {noformat}
> after 3 seconds: 2 starts, route Stopped, getRestartingRoutes()=[flaky],
> getExhaustedRoutes()=[]
> log: "Restarting route: flaky attempt: 1", and nothing after it
> {noformat}
> Found by reading the code, not reproduced: the first start of the supervised
> routes ({{doStartSupervisedRoutes}}) also catches only {{Exception}} around
> each route, so an Error there skips the routes after it.
> Suggested fix: in {{BackOffTimerTask.run()}}, catch {{Throwable}}, mark the
> task Failed and complete it with the Error. In the restart function, handle
> an Error that is not a {{VirtualMachineError}} as a failed attempt.
> _Claude Code on behalf of Croway_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)