shashank created CAMEL-27496:
--------------------------------
Summary: camel-google-pubsub - a subscriber loop that ends with an
error (non-retryable error, Error, async credentials failure) is never started
again while the route and its health check stay UP
Key: CAMEL-27496
URL: https://issues.apache.org/jira/browse/CAMEL-27496
Project: Camel
Issue Type: Bug
Components: camel-google-pubsub
Reporter: shashank
Assignee: shashank
h3. What happens
{{GooglePubsubConsumer}} runs {{concurrentConsumers}} subscriber loops. A loop
can end while the consumer is started, and nothing starts it again:
* synchronous pull, a non-retryable error from a pull ({{PERMISSION_DENIED}}
while an IAM binding is changed, {{NOT_FOUND}} while a subscription is created
again, {{DEADLINE_EXCEEDED}} on a long poll as in CAMEL-17185 when it is not in
{{synchronousPullRetryableCodes}}): it is rethrown and {{run()}} only logs it;
* asynchronous pull, a {{Subscriber}} that fails with a non-retryable error:
the loop ends on purpose ({{break}});
* asynchronous pull, an {{IOException}} from {{getSubscriber}} (credentials
that cannot be loaded at that moment): the call is outside the {{try}}, so even
a transient failure ends the loop, without the 5 s retry of the other
recoverable errors;
* an {{Error}} in the loop ({{NoClassDefFoundError}} / {{NoSuchMethodError}} of
a client library mismatch, {{ExceptionInInitializerError}}): {{run()}} catches
{{Exception}} only and the loop runs in a {{Future}} of {{executor.submit}}
that nothing reads, so it ends with no log line at all.
The route stays Started and the consumer health check reports UP: the consumer
has no health check of its own, so only the route status counts. The consumer
receives nothing until the route is restarted by hand, also after the cause is
gone.
CAMEL-27469 lists the synchronous pull of this component among the consumer
loops that end on an Error (not reproduced there yet). CAMEL-19016 asks for a
health check of this consumer.
h3. How to reproduce
With a stub whose first pull fails with {{PERMISSION_DENIED}} and whose later
pulls return a message: after the first pull nothing is pulled again, no
message is received, the route is Started and the consumer health check UP. The
same with a first {{getSubscriber}} that throws {{IOException}} (async), and
with a first {{getSubscriberStub}} that throws {{NoClassDefFoundError}} (no log
line at all).
Found with a TLA+ model of the pull loops ("while the health check is UP, some
loop of the current start runs" fails in both modes) and reproduced against the
real consumer.
h3. Fix
A failure that ends the pull ({{Exception}} or {{Error}}) is logged (first in a
row at ERROR with the stack trace, repeats in one WARN line) and given to the
exception handler with {{bridgeErrorHandler}}, and the loop subscribes or pulls
again after the retry delay of the asynchronous loop (5 s, counted from the
start of the failed attempt). After failed attempts, an asynchronous
{{Subscriber}} only counts as working once it has run for the retry delay (it
is running before its streaming pull is answered, so a missing subscription
fails it right after the start). A stop of the consumer ends a retry delay in
progress at once. A {{VirtualMachineError}} is logged at ERROR and thrown on. A
new consumer health check (readiness only) reports DOWN with the failure while
a loop of the current start waits to restart or has ended for good. Upgrade
guide entry: a consumer that stopped for good after a non-retryable error now
retries every 5 s and reports DOWN meanwhile.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)