Skip to content
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

triple 协议 stub 调用无法捕获自定义异常甚至 RpcException #12632

Closed
beastqin opened this issue Jun 30, 2023 · 3 comments
Closed

Comments

@beastqin
Copy link

version:dubbo 3.2.2
现象:使用 triple 协议 + IDL(protobuf stub),provider 端抛出RpcException 后,consumer 端无法捕获具体的 code,统一为Unknown,同理自定义异常也被处理为 Unknow RpcException。

Provider 端异常抛出代码:

   @Override
    public ListFollowersResponse listFollowers(ListFollowersOptions request) {
        throw new RpcException(BIZ_EXCEPTION, "test exception");
    }

Consumer 端日志打印:debug get rpc ex: org.apache.dubbo.rpc.StatusRpcException: UNKNOWN : test exception

因为比较疑惑,Dubbo 3.2.0 版本开始 Triple 协议支持回传自定义异常,所以扒了下原因:

            if (hasStub) {
                listener = new StubAbstractServerCall(invoker, TripleServerStream.this,
                    frameworkModel,
                    acceptEncoding, serviceName, originalMethodName, executor);
            } else {
                listener = new ReflectionAbstractServerCall(invoker, TripleServerStream.this,
                    frameworkModel, acceptEncoding, serviceName, originalMethodName, filters,
                    executor);
            }

看上去 TripleServerStream 在存在 stub 被调用时,会选用默认关闭 Exception Wrapper 的序列化选项的 StubAbstractServerCall。
所以,使用 IDL 调用是无法处理自定义异常吗?以及标准的 RpcException 的处理似乎也有问题。后续会解决这个问题吗?

@AlbumenJ
Copy link
Member

AlbumenJ commented Jul 3, 2023

@EarthChen @icodening PTAL

@icodening
Copy link
Contributor

@beastqin 可以尝试使用3.2.3,相关PR #12446

@deific
Copy link

deific commented Jul 4, 2023

我也遇到这个问题,使用3.2.3也不行,会报超时异常。

2023-07-04 15:13:43.305  WARN 11230 --- [imeout-thread-1] o.a.dubbo.common.timer.HashedWheelTimer  :  [DUBBO] An exception was thrown by TimerTask., dubbo version: 3.2.3, current host: 192.168.1.24, error code: 0-19. This may be caused by , go to https://dubbo.apache.org/faq/0/19 to find instructions. 

java.util.concurrent.RejectedExecutionException: null
	at org.apache.dubbo.common.threadpool.ThreadlessExecutor.execute(ThreadlessExecutor.java:101) ~[dubbo-3.2.3.jar:3.2.3]
	at org.apache.dubbo.rpc.protocol.tri.DeadlineFuture$TimeoutCheckTask.run(DeadlineFuture.java:153) ~[dubbo-3.2.3.jar:3.2.3]
	at org.apache.dubbo.common.timer.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:653) ~[dubbo-3.2.3.jar:3.2.3]
	at org.apache.dubbo.common.timer.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:732) ~[dubbo-3.2.3.jar:3.2.3]
	at org.apache.dubbo.common.timer.HashedWheelTimer$Worker.run(HashedWheelTimer.java:454) ~[dubbo-3.2.3.jar:3.2.3]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants