-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Handle cancel in ReleasingClientCall and rethrow the exception in start #1221
Conversation
gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/ChannelPoolTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcDirectStreamController.java
Outdated
Show resolved
Hide resolved
gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ChannelPool.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after nits
gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ChannelPool.java
Show resolved
Hide resolved
@burkedavison Do you think it's ok to merge this PR? Do you have any other concerns? Thanks! |
Hey @mutianf , |
Kudos, SonarCloud Quality Gate passed! |
…n start (#1221) * fix: Handle cancel in ReleasingClientCall and rethrow the exception in start * address comments
We got a customer issue and the stacktrace didn't show us where the call was cancelled (b/263968439)
When trying to reproduce this error, we noticed some inconsistent behaviors when we cancel the stream in onStart()
When the above code is called, we got exception:
However, if we make another call before it:
We got exception:
Which is very difficult to debug.
I think there are 2 problems in the ReleasingClientCall:
ClientCallImpl#startInternal
https://github.com/grpc/grpc-java/blob/v1.51.1/core/src/main/java/io/grpc/internal/ClientCallImpl.java#L199, where thecancelCalled
will be true and the state check will fail. In this case we won't see the actual stacktrace that cancelled the stream.IllegalStateException
thrown fromClientCallImpl#startInternal
will be caught,GrpcDirectStreamController
will move on toClientCallImpl#sendMessage
and eventually fail when checking if the stream is started https://github.com/grpc/grpc-java/blob/v1.51.1/core/src/main/java/io/grpc/internal/ClientCallImpl.java#L514.