diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/AbstractServerCallListener.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/AbstractServerCallListener.java index 7fa838d8d75..879cf44e101 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/AbstractServerCallListener.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/AbstractServerCallListener.java @@ -62,14 +62,18 @@ public void invoke() { final long stInMillis = System.currentTimeMillis(); try { final Result response = invoker.invoke(invocation); + if (response.hasException()) { + doOnResponseHasException(response.getException()); + return; + } response.whenCompleteWithContext((r, t) -> { responseObserver.setResponseAttachments(response.getObjectAttachments()); if (t != null) { responseObserver.onError(t); return; } - if (response.hasException()) { - doOnResponseHasException(response.getException()); + if (r.hasException()) { + doOnResponseHasException(r.getException()); return; } final long cost = System.currentTimeMillis() - stInMillis;