KEMBAR78
fix: update gRPC Bidi resumable upload to have more robust error message generation by BenWhitehead · Pull Request #2998 · googleapis/java-storage · GitHub
Skip to content

Conversation

@BenWhitehead
Copy link
Collaborator

onError can be called before a message is written to the stream, make sure we are accounting for the possibility that lastWrittenRequest can be null.

The fix prevents the following type of NPE from happening

Feb 18, 2025 10:39:15 PM io.grpc.internal.SerializingExecutor run
SEVERE: Exception while executing runnable io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed@5b549e5c
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:904)
	at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:42)
	at com.google.common.collect.ImmutableList.of(ImmutableList.java:101)
	at com.google.cloud.storage.GapicBidiUnbufferedWritableByteChannel$BidiObserver.onError(GapicBidiUnbufferedWritableByteChannel.java:355)
	at com.google.api.gax.rpc.ApiStreamObserverAdapter.onErrorImpl(ApiStreamObserverAdapter.java:61)
	at com.google.api.gax.rpc.StateCheckingResponseObserver.onError(StateCheckingResponseObserver.java:84)
	at com.google.api.gax.tracing.TracedResponseObserver.onError(TracedResponseObserver.java:104)
	at com.google.api.gax.grpc.ExceptionResponseObserver.onErrorImpl(ExceptionResponseObserver.java:84)
	at com.google.api.gax.rpc.StateCheckingResponseObserver.onError(StateCheckingResponseObserver.java:84)
	at com.google.api.gax.grpc.GrpcDirectStreamController$ResponseObserverAdapter.onClose(GrpcDirectStreamController.java:148)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.api.gax.grpc.ChannelPool$ReleasingClientCall$1.onClose(ChannelPool.java:569)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.cloud.storage.it.GrpcPlainRequestLoggingInterceptor$1$1.onClose(GrpcPlainRequestLoggingInterceptor.java:92)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564)
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:729)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:710)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

…age generation

onError can be called before a message is written to the stream, make sure we are accounting for the possibility that lastWrittenRequest can be null.
@BenWhitehead BenWhitehead requested a review from a team as a code owner March 18, 2025 21:09
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: storage Issues related to the googleapis/java-storage API. labels Mar 18, 2025
@BenWhitehead BenWhitehead merged commit 79b5d85 into main Mar 18, 2025
31 checks passed
@BenWhitehead BenWhitehead deleted the grpc/bidi/resumable-error-fix branch March 18, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants