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

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

> camel-google-pubsub - with synchronousPull, a pull that fails at once 
> (credentials that cannot be loaded) is retried in a tight loop, with a stack 
> trace in the log for each attempt
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27495
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27495
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google-pubsub
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>             Fix For: 4.25.0
>
>
> h3. What happens
> With {{synchronousPull=true}}, each subscriber loop of 
> {{GooglePubsubConsumer}} builds a {{SubscriberStub}} for every pull, which 
> loads the credentials of the endpoint. When they cannot be loaded (a service 
> account key file that was removed or rotated, Application Default Credentials 
> not available, a metadata server that does not answer), {{getSubscriberStub}} 
> throws {{IOException}}. The loop logs it at ERROR with its stack trace ("I/O 
> exception while getting messages from PubSub. Reconnecting.") and pulls again 
> at once: no delay and no limit.
> With a missing key file one loop made about 44,000 attempts per second, each 
> logged with a stack trace (about 40 MB of log in 1.3 s), and used a full CPU 
> core, until the credentials came back. The route stays Started and the health 
> check UP. The asynchronous consumer waits 5 seconds after a recoverable error.
> A retryable {{ApiException}} from a pull is also pulled again at once. With 
> the default pull settings the client library returns it only after retrying 
> it for up to a minute, so this is not a tight loop in practice, but a pull 
> that fails at once with a retryable code (for example one added with 
> {{synchronousPullRetryableCodes}}) spins the same way.
> h3. How to reproduce
> A route 
> {{from("google-pubsub:project:subscription?synchronousPull=true&serviceAccountKey=file:missing.json")}}:
>  the log fills with {{FileNotFoundException}} stack traces as fast as the 
> thread can write them.
> Found with a TLA+ model of the pull loops ("failed attempts per loop per tick 
> are bounded" fails) and reproduced against the real consumer.
> h3. Fix
> After a failed attempt (the {{IOException}} and the retryable 
> {{ApiException}} paths) the synchronous loop waits until the retry delay of 
> the asynchronous loop (5 s) has passed since the attempt started, then pulls 
> again, so at most one failed attempt per 5 seconds and no extra delay after 
> an attempt that already took that long. A stop of the consumer ends a wait in 
> progress at once. The first failure in a row is logged at ERROR with its 
> stack trace, the next ones in one WARN line, and the first pull that works 
> again at INFO.
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to