shashank created CAMEL-27490:
--------------------------------

             Summary: camel-aws-secrets-manager - a CloudTrail or SQS call of 
the refresh task that does not get an answer holds the thread of every periodic 
task of the CamelContext
                 Key: CAMEL-27490
                 URL: https://issues.apache.org/jira/browse/CAMEL-27490
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
            Reporter: shashank
            Assignee: shashank


h3. What happens

All the periodic tasks of a CamelContext run one after the other on one thread 
({{TimerListenerManager}}, through {{PeriodicTaskWrapper.onTimer}}): the secret 
refresh tasks of every vault, and other tasks such as the Service Bus lock 
renewer. {{CloudTrailReloadTriggerTask}} builds its {{CloudTrailClient}} and 
{{SqsClient}} without an override configuration, so their calls have no API 
call timeout: a call is only bounded by the socket timeout of the HTTP client 
and the SDK retries, and a slow answer is not bounded at all. While 
{{lookupEvents}} or {{receiveMessage}} waits, no other periodic task runs.

In a test, a probe periodic task with a period of 1 s went about 10 s without 
running while {{lookupEvents}} took 8 s. The Service Bus lock renewer runs on 
that thread too, so its locks can expire during such a stall (inferred from its 
timing, not reproduced).

With SQS notification, a receive wait time (long polling) set on the queue also 
makes each check wait on that thread, for up to 20 s.

Found with a TLA+ model of the shared periodic task thread: "every periodic 
task runs at least once per period plus a bounded call time" fails when a store 
call is slow.

h3. Fix

The task sets an API call timeout of 10 seconds (retries included) on both 
clients, so one call cannot hold the thread longer than that; a call that times 
out is logged and tried again at the next check, as any other failed call. The 
SQS receive uses a wait time of 0 seconds, so the queue's long polling does not 
make it wait (and is not cut by the timeout). The timeout is documented on the 
component page and in the upgrade guide.

Not changed here: other blocking work on the same thread remains a risk, such 
as the context reload itself (a graceful route shutdown) and the other periodic 
tasks.

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to