Federico Mariani created CAMEL-27470:
----------------------------------------

             Summary: camel-timer - a VirtualMachineError in a timer route 
stops every timer route with the same timer name
                 Key: CAMEL-27470
                 URL: https://issues.apache.org/jira/browse/CAMEL-27470
             Project: Camel
          Issue Type: Sub-task
          Components: camel-core
            Reporter: Federico Mariani


{{TimerConsumer}} sends the exchanges from a {{java.util.TimerTask}} whose 
{{run()}} catches only {{Exception}}. A {{VirtualMachineError}} thrown in the 
route, which CAMEL-26741 throws on to the caller on purpose (such as a 
{{StackOverflowError}} of a recursive call), ends the thread of the 
{{java.util.Timer}}, and the Timer then cancels all its tasks. Every timer 
route that uses the same timer (the same {{timerName}}, by default the name in 
the URI) stops firing, and the routes still say Started. Only the default 
handler of the JVM prints the Error, on stderr.

Reproduced on main, with two routes from {{timer:shared?period=50}}, the first 
of which throws a {{StackOverflowError}} on its third exchange:
{noformat}
route a: 3 exchanges, then none in the next 2 seconds, status Started
route b: 2 exchanges, then none in the next 2 seconds, status Started
{noformat}

With a negative {{delay}}, the loop on the executor has no catch either (found 
by reading the code, not reproduced).

Suggested fix: catch the Error in {{run()}} and log it at ERROR. A 
{{VirtualMachineError}} may at most cancel the task of this route 
({{TimerTask.cancel()}}), so that it does not end the Timer that other routes 
share.

_Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to