-
Notifications
You must be signed in to change notification settings - Fork 434
Open
Description
Hello,
I tried to update from v5.0.0 to v5.1.4, I observed a change in the status code handling when an exception occurs.
My service uses streaming. Here's a snippet of the relevant code:
service MyService {
rpc Streaming(stream MyRequest) returns (stream MyResponse) {}
}In the context of onFailure, pass StatusRuntimeException to observer.onError.
simplified code snippet below:
override fun streaming(responseObserver: StreamObserver<MyResponse>): StreamObserver<MyRequest> {
override fun onCompleted() {
runCatching {
// some processing
}.onFailure {
responseObserver.onError(
Status.NOT_FOUND
.withCause(Exception("some exception"))
.asRuntimeException()) //to StatusRuntimeException
}
}
}In v5.0.0
ERROR:
Code: NOT_FOUND
In v5.1.4
ERROR:
Code: INTERNAL
The issue below mentions a problem with StatusException, but the issue also occurs with StatusRuntimeException.
#371
It appears that the newly introduced passage through the failureHandlingSupport.closeCall method is causing the impact.
Lines 48 to 53 in b6f9a75
| Boolean handled = Optional.ofNullable(EXCEPTION_HANDLED.get()) | |
| .map(AtomicBoolean::get) | |
| .orElse(!exceptionHandled.compareAndSet(false, true)); | |
| if(null != status.getCause() && !handled){ | |
| failureHandlingSupport.closeCall(new GRpcRuntimeExceptionWrapper(status.getCause()), this, trailers); | |
| } |
If I've implemented something contrary to your intentions, please let me know.
Thank you always for your support.
Metadata
Metadata
Assignees
Labels
No labels