GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LoggingHandler hangs the thread · Issue #2796 · googleapis/google-cloud-java

LoggingHandler hangs the thread #2796

New issue
Copy link
New issue
Copy link
Closed
Closed
LoggingHandler hangs the thread#2796
Copy link
Assignees
ajaaym
Labels
api: loggingIssues related to the Cloud Logging API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@sparhomenko
sparhomenko
opened on Jan 20, 2018
Issue body actions

Our application is running on Google Kubernetes Engine using gcr.io/google-appengine/jetty image and used com.google.cloud.logging.LoggingHandler to publish logs on Stackdriver. We noticed some worker threads becoming unresponsive over time. When the pod is shutting down we can see the following exception for each:

java.lang.RuntimeException: java.lang.InterruptedException
	at com.google.cloud.logging.LoggingImpl.flush(LoggingImpl.java:545)
	at com.google.cloud.logging.LoggingImpl.write(LoggingImpl.java:525)
	at com.google.cloud.logging.LoggingHandler.publish(LoggingHandler.java:273)
	at java.util.logging.Logger.log(Logger.java:738)
	at org.slf4j.impl.JDK14LoggerAdapter.log(JDK14LoggerAdapter.java:582)
	at org.slf4j.impl.JDK14LoggerAdapter.error(JDK14LoggerAdapter.java:500)
        ...
Caused by: java.lang.InterruptedException
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:449)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)
	at com.google.cloud.logging.LoggingImpl.flush(LoggingImpl.java:543)
	... 30 more

We'll try to extract a thread dump to see why the future never completes, but the issue seems dangerous by itself: LoggingImpl.java:543 uses the non-timeout version of Future.get() which can cause any logger call to block the current thread forever unless interrupted. Would it be possible to use the timeout version with a reasonably big timeout, e.g. 60 seconds?

Activity

Next
  1. pongad
    self-assigned this
    on Jan 22, 2018
  2. pongad commented on Jan 22, 2018

    @pongad
    pongad
    on Jan 22, 2018
    Contributor
    More actions

    This seems related to #1795. The underlying client provides no way to initiate a flush.

    @sparhomenko Do you have a sense of how long we're waiting? The above bug might cause us to wait a few seconds, but it shouldn't cause a prolonged hang. I agree that the wait with no timeout is a problem, but I want to understand the problem better before sending fixes.

    Reacted by Joshua Fox
  3. pongad
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: loggingIssues related to the Cloud Logging API.
    on Jan 22, 2018
  4. sparhomenko commented on Jan 22, 2018

    @sparhomenko
    sparhomenko
    on Jan 22, 2018
    Author
    More actions

    @pongad Longest one we observed so far was 2.5 hours until manually interrupted. We're not sure what caused the future to hang for so long. The issue seems to be intermittently reproducible, I'll try to get more diagnostic information next time we hit it.

  5. pongad commented on Jan 25, 2018

    @pongad
    pongad
    on Jan 25, 2018
    Contributor
    More actions

    @sparhomenko Yikes! 2.5 hours is WAY beyond reasonable. I now suspect some kind of propagation problem somewhere. Maybe we don't properly complete the future for something. I'll try to dig into this as well, but a repro would be greatly appreciated.

  6. pongad
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Feb 6, 2018
  7. pongad commented on Feb 12, 2018

    @pongad
    pongad
    on Feb 12, 2018
    Contributor
    More actions

    @tamersaleh I unfortunately don't have concrete progress to share yet. We plan to simplify the batching logic. The simplification should let us smoke out many of these bugs.

  8. sparhomenko commented on Feb 12, 2018

    @sparhomenko
    sparhomenko
    on Feb 12, 2018
    Author
    More actions

    @pongad I'm afraid we are not able to reproduce the issue anymore. The only useful thing we found was that on the pods where this was reproducible LoggingHandler actually stopped providing any logs after this exception occurred:

    java.lang.RuntimeException: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: UNAVAILABLE: 503:Service Unavailable
    	at com.google.cloud.logging.LoggingImpl$7.onFailure(LoggingImpl.java:577)
    	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:52)
    	at com.google.common.util.concurrent.Futures$6.run(Futures.java:1764)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(Futures.java:1405)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at com.google.common.util.concurrent.Futures$AbstractCatchingFuture.run(Futures.java:794)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:96)
    	at com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:78)
    	at com.google.api.gax.grpc.BatchedRequestIssuer.sendResult(BatchedRequestIssuer.java:68)
    	at com.google.api.gax.grpc.BatchExecutor$1.onFailure(BatchExecutor.java:96)
    	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:52)
    	at com.google.common.util.concurrent.Futures$6.run(Futures.java:1764)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at com.google.api.gax.retrying.RetryingFutureImpl.executeAttempt(RetryingFutureImpl.java:142)
    	at com.google.api.gax.retrying.RetryingFutureImpl.access$500(RetryingFutureImpl.java:58)
    	at com.google.api.gax.retrying.RetryingFutureImpl$AttemptFutureCallback.onFailure(RetryingFutureImpl.java:176)
    	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:52)
    	at com.google.common.util.concurrent.Futures$6.run(Futures.java:1764)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:96)
    	at com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:78)
    	at com.google.api.gax.grpc.ExceptionTransformingCallable$ExceptionTransformingFuture.onFailure(ExceptionTransformingCallable.java:108)
    	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:52)
    	at com.google.common.util.concurrent.Futures$6.run(Futures.java:1764)
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
    	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
    	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
    	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
    	at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:463)
    	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:439)
    	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:428)
    	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
    	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:514)
    	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:431)
    	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:546)
    	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
    	at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:152)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: UNAVAILABLE: 503:Service Unavailable
    	at com.google.cloud.logging.spi.v2.GrpcLoggingRpc$1.apply(GrpcLoggingRpc.java:141)
    	at com.google.cloud.logging.spi.v2.GrpcLoggingRpc$1.apply(GrpcLoggingRpc.java:135)
    	at com.google.api.core.ApiFutures$GaxFunctionToGuavaFunction.apply(ApiFutures.java:124)
    	at com.google.common.util.concurrent.Futures$CatchingFuture.doFallback(Futures.java:842)
    	at com.google.common.util.concurrent.Futures$CatchingFuture.doFallback(Futures.java:834)
    	at com.google.common.util.concurrent.Futures$AbstractCatchingFuture.run(Futures.java:789)
    	... 48 more
    Caused by: com.google.api.gax.grpc.ApiException: io.grpc.StatusRuntimeException: UNAVAILABLE: 503:Service Unavailable
    	... 23 more
    Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: 503:Service Unavailable
    	at io.grpc.Status.asRuntimeException(Status.java:540)
    	... 15 more

    These might have been caused by us producing too many logs, which we are not doing anymore.

    One other suspicious thing is that latest version of google-appengine Docker image we use is still using a pretty old version of google-cloud-logging and related dependencies. So the issue might have been triggered by a problem in that version, or by a classpath conflict between the provided dependencies and the newer ones we package in our WAR.

  9. dansomething commented on Feb 12, 2018

    @dansomething
    dansomething
    on Feb 12, 2018
    More actions

    FWIW, we have experienced similar issues using both JUL and Logback as our client for google-cloud-logging. The hangs seem to correlate with GRPC connection issues. We have sadly never been able to reliably reproduce the issue. We eventually had to give up on using the "Enhanced Stackdriver Logging" feature of the jetty-runtime.

    Here some stracktraces from our logs if that helps.

    java.lang.RuntimeException: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 49999922530ns at com.google.cloud.logging.LoggingImpl$7.onFailure(LoggingImpl.java:577) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:112) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:134) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:95) at
     com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:77) at
     com.google.api.gax.rpc.BatchedFuture.setException(BatchedFuture.java:55) at
     com.google.api.gax.rpc.BatchedRequestIssuer.sendResult(BatchedRequestIssuer.java:82) at
     com.google.api.gax.rpc.BatchExecutor$1.onFailure(BatchExecutor.java:96) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.gax.retrying.BasicRetryingFuture.handleAttempt(BasicRetryingFuture.java:157) at
     com.google.api.gax.retrying.CallbackChainRetryingFuture$AttemptCompletionListener.handle(CallbackChainRetryingFuture.java:134) at
     com.google.api.gax.retrying.CallbackChainRetryingFuture$AttemptCompletionListener.run(CallbackChainRetryingFuture.java:116) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:95) at
     com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:77) at
     com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.setException(GrpcExceptionCallable.java:117) at
     com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:101) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:458) at
     io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:433) at
     io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) at
     io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:339) at
     io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:443) at
     io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:525) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:446) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:557) at
     io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at
     io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:107) at
     java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at
     java.util.concurrent.FutureTask.run(FutureTask.java:266) at
     java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at
     java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at
     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at
     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at
     java.lang.Thread.run(Thread.java:748) Caused by: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 49999922530ns at com.google.cloud.logging.spi.v2.GrpcLoggingRpc$2.apply(GrpcLoggingRpc.java:155) at
     com.google.cloud.logging.spi.v2.GrpcLoggingRpc$2.apply(GrpcLoggingRpc.java:149) at
     com.google.api.core.ApiFutures$GaxFunctionToGuavaFunction.apply(ApiFutures.java:153) at
     com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:205) at
     com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:193) at
     com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:132)
    java.lang.RuntimeException: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: UNAVAILABLE: Authentication backend unavailable. at com.google.cloud.logging.LoggingImpl$7.onFailure(LoggingImpl.java:577) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:112) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:134) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:95) at
     com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:77) at
     com.google.api.gax.rpc.BatchedFuture.setException(BatchedFuture.java:55) at
     com.google.api.gax.rpc.BatchedRequestIssuer.sendResult(BatchedRequestIssuer.java:82) at
     com.google.api.gax.rpc.BatchExecutor$1.onFailure(BatchExecutor.java:96) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.gax.retrying.BasicRetryingFuture.handleAttempt(BasicRetryingFuture.java:157) at
     com.google.api.gax.retrying.CallbackChainRetryingFuture$AttemptCompletionListener.handle(CallbackChainRetryingFuture.java:134) at
     com.google.api.gax.retrying.CallbackChainRetryingFuture$AttemptCompletionListener.run(CallbackChainRetryingFuture.java:116) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:95) at
     com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:77) at
     com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.setException(GrpcExceptionCallable.java:117) at
     com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:101) at
     com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61) at
     com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) at
     com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) at
     com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) at
     com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) at
     com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) at
     io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:458) at
     io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:433) at
     io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) at
     io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:339) at
     io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:443) at
     io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:525) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:446) at
     io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:557) at
     io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at
     io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:107) at
     java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at
     java.util.concurrent.FutureTask.run(FutureTask.java:266) at
     java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at
     java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at
     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at
     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at
     java.lang.Thread.run(Thread.java:748) Caused by: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: UNAVAILABLE: Authentication backend unavailable. at com.google.cloud.logging.spi.v2.GrpcLoggingRpc$2.apply(GrpcLoggingRpc.java:155) at
     com.google.cloud.logging.spi.v2.GrpcLoggingRpc$2.apply(GrpcLoggingRpc.java:149) at
     com.google.api.core.ApiFutures$GaxFunctionToGuavaFunction.apply(ApiFutures.java:153) at
     com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:205) at
     com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:193) at
     com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:132)
  10. pongad commented on Feb 13, 2018

    @pongad
    pongad
    on Feb 13, 2018
    Contributor
    More actions

    The method taking 1min to timeout is curious. That's the deadline we set on our RPCs but Logging shouldn't take that long. This might be related to threads being in BLOCKED state; if threads are blocked, they can't service RPC.

    Could you share with us the stack trace of the BLOCKED threads?

    @garrettjonesgoogle FYI

  11. pongad commented on Feb 14, 2018

    @pongad
    pongad
    on Feb 14, 2018
    Contributor
    More actions

    @tamersaleh Both of these are somewhat expected.

    For WAITING, the thread seems to be waiting to lock a shared structure. I'd expect the number to be relatively small though, since the threads should update the structure then unlock quickly.

    For the BLOCKED, that's caused by Logging throttling the application because there are too many logs waiting to be sent. This usually happens when the logs are generated faster than they can be sent to the server.

    I assume you're not deadlocked, but progressing slowly? Do you have a sense of how many logs you're sending and how large they are? If the RPCs are too slow, there are some enhancements we can make, like opening multiple connections, etc.

  12. 15 remaining items

  13. dave-r12 commented on Dec 26, 2018

    @dave-r12
    dave-r12
    on Dec 26, 2018
    More actions

    Hey, I've also hit this issue. I was able to replicate it (mostly reliable) with this piece of code:

        var latch1 = new CountDownLatch(1);
        var thread1 = new Thread(() -> {
          try {
            latch1.await();
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          log.error(Strings.repeat("a", 210000));
        });
        var thread2 = new Thread(() -> {
          latch1.countDown();
          try {
            Thread.sleep(5);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          log.info("Hello");
        });
    
        thread1.start();
        thread2.start();
    
        thread1.join();
        thread2.join();

    I'm unfamiliar with the implementation but I was seeing this crop up when we attempted to log a very big message, causing the GCP logging impl to throw a RuntimeException (message > 110K). In the above code it happens in the log.error() call. This seems to cause an issue when a separate, concurrent thread is also logging something but just after the exception! The sequence is deliberate.

  14. ajaaym
    added a commit that references this issue on Dec 28, 2018

    fix googleapis#3880 googleapis#2796 disable automatic flush on write …

    41d03ca
  15. chingor13
    added a commit that references this issue on Jan 2, 2019

    Logging: disable severity based flush on write by default (#4254)

    63a9cb7
  16. ajaaym commented on Jan 2, 2019

    @ajaaym
    ajaaym
    on Jan 2, 2019
    Contributor
    More actions

    fixed in #4254

  17. ajaaym
    closed this as completedon Jan 2, 2019
  18. snehashah16
    added a commit that references this issue on Feb 3, 2019

    Merge request (#4436)

    47c840e
  19. JustinBeckwith
    assigned
    ajaaym
    on Feb 1, 2021
  20. meltsufin
    added a commit that references this issue on Dec 22, 2025

    Logging: disable severity based flush on write by default (#4254)

    0cc782c
  21. suztomo
    added 2 commits that reference this issue on Mar 9, 2026

    chore(main): release 2.30.1-SNAPSHOT (#2796)

    c83ea0d

    Logging: disable severity based flush on write by default (googleapis…

    0effe5e
  22. chingor13
    added 4 commits that reference this issue on Mar 24, 2026

    deps: update netty dependencies to v4.1.110.final (#2796)

    4148d4c

    chore(main): release 2.41.0 (#2820)

    86b29e1

    ci: unmanaged dependency check (#2796)

    9898f6f

    chore(main): release 2.44.1 (#2796)

    118fedf
  23. rahul2393
    added a commit that references this issue on May 21, 2026

    chore: factor out per operation settings into a separate class (googl…

    85814dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ajaaym
    ajaaym

Labels

api: loggingIssues related to the Cloud Logging API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.