mirror of https://github.com/grpc/grpc-java.git
core: add description to Status.UNKNOWN in ServerImpl's #internalClose (#10643)
This is currently the only place where we return Status.UNKNOWN with no description, which makes is harder to debug and differentiate from statuses originated from non-grpc sources. This PR enriches ServerImpl's #internalClose `Status.UNKNOWN` with description `Application error processing RPC`.
This commit is contained in:
parent
15fc70be2a
commit
8b4b14ac40
|
|
@ -810,7 +810,8 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
|||
*/
|
||||
private void internalClose(Throwable t) {
|
||||
// TODO(ejona86): this is not thread-safe :)
|
||||
stream.close(Status.UNKNOWN.withCause(t), new Metadata());
|
||||
String description = "Application error processing RPC";
|
||||
stream.close(Status.UNKNOWN.withDescription(description).withCause(t), new Metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -249,7 +249,11 @@ public class MoreInProcessTest {
|
|||
.onNext(StreamingInputCallRequest.getDefaultInstance());
|
||||
|
||||
assertTrue(finishLatch.await(900, TimeUnit.MILLISECONDS));
|
||||
assertEquals(Status.UNKNOWN, Status.fromThrowable(throwableRef.get()));
|
||||
Status actualStatus = Status.fromThrowable(throwableRef.get());
|
||||
Status expectedStatus = Status.UNKNOWN.withDescription("Application error processing RPC");
|
||||
assertEquals(expectedStatus.getCode(), actualStatus.getCode());
|
||||
assertEquals(expectedStatus.getDescription(), actualStatus.getDescription());
|
||||
assertNull(actualStatus.getCause());
|
||||
assertNull(responseRef.get());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue