[ 
https://issues.apache.org/jira/browse/CAMEL-27493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

shashank updated CAMEL-27493:
-----------------------------
    Fix Version/s: 4.25.0

> camel-ibm-secrets-manager - one failed poll of IBM Event Streams ends the 
> secret refresh task for good, without a log line, so later secret rotations 
> no longer reload the CamelContext
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27493
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27493
>             Project: Camel
>          Issue Type: Bug
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>             Fix For: 4.25.0
>
>
> h3. What happens
> {{IBMEventStreamReloadTriggerTask}} is scheduled once 
> ({{PeriodTaskScheduler.scheduledTask}}): {{DefaultPeriodTaskScheduler}} 
> submits it to its own thread on the first timer tick and never looks at its 
> {{Future}} again. Its {{run()}} polls the IBM Event Streams topic in a loop 
> for as long as Camel runs. CAMEL-25702 put a try around the handling of each 
> record, but {{kafkaConsumer.poll()}} itself is outside it.
> So the first exception from {{poll()}} ends the task: for example the 
> {{SaslAuthenticationException}} that {{KafkaConsumer.poll}} throws when the 
> broker rejects the credentials, or an authorization error. The exception 
> stays in the {{Future}} that nobody reads, nothing is logged, every later 
> timer tick sees the task as running, and the secrets dev console still shows 
> the task. When the broker accepts the credentials again and a watched secret 
> is rotated, no reload happens until the application is restarted.
> h3. How to reproduce
> Schedule the task through the CamelContext's {{PeriodTaskScheduler}} (as 
> Camel Main does) with a {{KafkaConsumer}} whose first poll throws 
> {{SaslAuthenticationException}} and whose next poll returns a 
> {{secret_rotated}} event for a watched secret: {{run()}} is entered once, 
> there are 0 polls after the failure and 0 reloads, the rotation is never 
> read, and the log has no line about the failure.
> Found with a TLA+ model of the push-based vault refresh listeners and the 
> period task scheduler: the property "every rotation is eventually consumed 
> while Camel runs" fails after one exception from {{poll()}}.
> h3. Fix
> Catch a failure of {{poll()}} in the loop: log it (the first failure in a row 
> at WARN, repeats at DEBUG, the first poll that works again at INFO), wait (1 
> s, doubling up to 60 s) and poll again with the same consumer, which 
> authenticates again on a later poll. The consumer keeps the credentials read 
> when the task started: if that Event Streams API key is revoked (for example 
> after it was rotated), the polls keep failing until a restart with the new 
> key, now with a WARN; a new consumer would read the same password. An 
> {{Error}} is logged at ERROR and handled the same way; a 
> {{VirtualMachineError}} is thrown on. The loop still ends when Camel stops. 
> {{lastCheckTime}} is also set after each poll that works, so the dev console 
> shows when the task stopped polling successfully.
> Not changed: the scheduler still submits the task only once (the Kubernetes 
> refresh tasks use the same {{scheduledTask}}); a CamelContext stop and start 
> drops the scheduled vault refresh tasks; {{doStop}} closes the consumer from 
> another thread while the loop is inside {{poll()}}, so it is not closed (low, 
> separate follow-ups).
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to