fix Dubbo3.x Context problem #8525#110
Conversation
| return invoker.getUrl() | ||
| .getParameter("side", "consumer") | ||
| .equals("provider"); |
There was a problem hiding this comment.
Is this an official way? It seems strange. I am waiting for Dubbo team to response.
There was a problem hiding this comment.
We can wait for the Dubbo team...
I write this from my understanding to the scope of Rpc*Context and RpcInvocation.
The RpcServiceContext#isConsumerSide() implements like:
public boolean isConsumerSide() {
return this.getUrl().getSide("provider").equals("consumer");
}There was a problem hiding this comment.
If this is already official, could we use RpcServiceContext#isConsumerSide() directly?
There was a problem hiding this comment.
The problem is RpcServiceContext not been reset when it's role switched, but RpcInvocation is always correctly bounded to the current request or serve request
There was a problem hiding this comment.
Oh, I see. Could you add this as comments on the codes? This is important to keep this in mind why we change now.
There was a problem hiding this comment.
OK, same as I see. I will modify it and pass the test.
There was a problem hiding this comment.
Yes, we just need to declare the parent class only.
There was a problem hiding this comment.
But I can't see the link from your comments, but the conclusion is certain.
There was a problem hiding this comment.
#73 (comment)
I reduced 2 Instrumentation to 1 and testing it.
|
@honganan Could you make this PR works? I am not sure why Dubbocommunity seems not responsing. Let's try at our side. |
|
@honganan Any update? |
| if (result != null && result.getException() != null) { | ||
| dealException(result.getException()); | ||
| } |
There was a problem hiding this comment.
Do we need to process result#getExcetpion?
There was a problem hiding this comment.
I haven't received notifications these days, I will debug and make it clear about how it process Exceptions.
There was a problem hiding this comment.
Usually, we don't need to catch exceptions, as the handleMethodException method exists already. But we should process result#getExcetpion, because this exception may throw after the whole intercepting is finished or even wouldn't, depending on Dubbo's implementation.
|
I can, in these two days. I need more time to make it clear how Dubbo handle exception. |
@honganan I think you missed some UTs. |
|
I will figure this out tomorrow morning.
…------------------ Original ------------------
From: 吴晟 Wu Sheng ***@***.***>
Date: Thu,Feb 24,2022 10:53 PM
To: apache/skywalking-java ***@***.***>
Cc: 洪阿南 ***@***.***>, Mention ***@***.***>
Subject: Re: [apache/skywalking-java] fix Dubbo3.x Context problem #8525 (PR#110)
Error: testConsumerWithException(org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest) Time elapsed: 2.085 s <<< ERROR! java.lang.NullPointerException at org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest.testConsumerWithException(DubboInterceptorTest.java:156) Error: testConsumerWithResultHasException(org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest) Time elapsed: 0.013 s <<< ERROR! java.lang.NullPointerException at org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest.testConsumerWithResultHasException(DubboInterceptorTest.java:169) Error: testConsumerWithAttachment(org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest) Time elapsed: 0.008 s <<< ERROR! java.lang.NullPointerException at org.apache.skywalking.apm.plugin.dubbo3.DubboInterceptorTest.testConsumerWithAttachment(DubboInterceptorTest.java:144)
@honganan I think you missed some UTs.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
I think this mock preparation is not enough, should be enhanced with the URL you expect. |
Do you mean add clean |
|
It's strange the Unit Test fails with NPE, unless |
|
I can't see you mocked the attachment in This is easy to reproduce locally. |
| } else { | ||
| isConsumer = serviceContext.isConsumerSide(); | ||
| } | ||
| boolean isConsumer = isConsumer(invocation); |
There was a problem hiding this comment.
@wu-sheng I'm a little confused about this. Why not judge whether it is the consumer side directly from EnhancedInstance objInst. If objInst is a MonitorFilter object, it should be on the provider side. If objInst is a MonitorClusterFilter object, it should be on the provider side.
There was a problem hiding this comment.
We just enhanced MonitorFilter class finally, as MonitorClusterFilter extends MonitorFilter and enhance both of them will cause problem. We have talked above.

CHANGESlog.