shashank created CAMEL-26909:
--------------------------------
Summary: camel-core - an Error of the supplier of a BackgroundTask
leaves run() waiting forever
Key: CAMEL-26909
URL: https://issues.apache.org/jira/browse/CAMEL-26909
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26741 and CAMEL-24286. {{BackgroundTask}} runs its supplier
from a task scheduled with {{scheduleWithFixedDelay}}. Since CAMEL-24286 an
exception of the supplier marks the task as failed, unregisters it and releases
the caller of {{run()}} before it is thrown on. An {{Error}} that is not a
{{VirtualMachineError}} (such as a {{NoClassDefFoundError}} of the client
library a task connects with) is not caught there: it ends the schedule, and a
{{run()}} with an unlimited duration waits forever (with a time budget, until
the budget runs out), with the task left in the {{TaskManagerRegistry}} and its
status {{Active}}.
Tasks that a caller waits on with {{run()}} and an unlimited duration, with a
supplier that catches only {{Exception}}, include the connect of
camel-ftp/sftp, the reconnect of camel-kafka, camel-kafka-share, camel-pgevent
and of the camel-smpp consumer and producer (which hold their reconnect lock
while they wait), and the polling of camel-mongodb-gridfs. A task started with
{{schedule()}} (camel-master, the connection recovery of camel-sjms) has no
caller waiting: there the {{Error}} ends the schedule silently and leaves the
task {{Active}} in the registry. Nothing logs the {{Error}}.
Expected: such an {{Error}} is handled as an exception: the task fails with it
as its cause (logged at WARN), {{run()}} returns false, and the task is
unregistered; a {{VirtualMachineError}} is left as before.
Found while going through the follow-ups of CAMEL-26741; confirmed with a test
on the real class.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)