Vincet Paturet created CAMEL-17185:
--------------------------------------

             Summary:  Synchronous Pull Consumer disconnected after PubSub 
server error
                 Key: CAMEL-17185
                 URL: https://issues.apache.org/jira/browse/CAMEL-17185
             Project: Camel
          Issue Type: Bug
          Components: camel-google-pubsub
    Affects Versions: 3.11.3
            Reporter: Vincet Paturet


Using Camel 3.11.3 we experience intermittent disconnections when configuring a 
Google PubSub endpoint in synchronous pull mode.
The application logs a warning message and then stops pulling new messages.
{code:java}
com.google.api.gax.rpc.DeadlineExceededException: 
io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 
59.985104781s. [buffered_nanos=7626625, 
remote_addr=pubsub.googleapis.com/74.125.140.95:443] at 
com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:51)
 at 
com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
 at 
com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
 at 
com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
 at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68) at 
com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1074)
 at 
com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
 at 
com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1213)
 at 
com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:983)
 at 
com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:771)
 at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:563) at 
io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533) at 
io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463)
 at 
io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427)
 at 
io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460)
 at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:553) at 
io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:68) at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:739)
 at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:718)
 at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at 
io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 
at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
 Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown 
Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown 
Source) at java.base/java.lang.Thread.run(Unknown Source) Suppressed: 
com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed at 
com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)
 at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112) at 
org.apache.camel.component.google.pubsub.GooglePubsubConsumer$SubscriberWrapper.synchronousPull(GooglePubsubConsumer.java:185){code}
 
The fix applied in CAMEL-16263 allows the SubscriberWrapper thread to recover 
from a retryable PubSub server error.
However the PubSub client library retries only ABORTED, UNAVAILABLE,  UNKNOWN 
errors by default.

Proposed fix: add a component option to specify additional retryable error 
codes in synchronous pull mode.
It is possible to configure custom retryable codes by using the method 
builder.pullSettings().setRetryableCodes() in SubscriberStubSettings.Builder


Note: The default builder SubscriberStubSettings.Builder configures retries 
with exponential backoff (current default settings: retrying during 1 minute).
In addition the loop in 
org.apache.camel.component.google.pubsub.GooglePubsubConsumer.SubscriberWrapper#synchronousPull
 ensures that the consumer will trigger a new request when the retries end, 
effectively retrying forever.

 

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to