Federico Mariani created CAMEL-27472:
----------------------------------------
Summary: 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
{{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)