You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/11/28 08:31:28 UTC

[GitHub] [dubbo] AlbumenJ commented on a change in pull request #9284: [3.0] save current rpc service context to url at the beginning of invocation to support LazyConnectExchangeClient and avoid NPE

AlbumenJ commented on a change in pull request #9284:
URL: https://github.com/apache/dubbo/pull/9284#discussion_r757860849



##########
File path: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
##########
@@ -182,6 +182,9 @@ public Result invoke(Invocation inv) throws RpcException {
     }
 
     private void prepareInvocation(RpcInvocation inv) {
+        // fix #9283: set service context of InstanceAddressURL before other preparation.
+        url.setContext(RpcContext.getServiceContext());

Review comment:
       URL 对象在服务间是复用的(即使不复用也会有问题)。在并发请求的时候,会出现一个 URL 只持有了一个上下文的情况,但实际上有很多个上下文同时使用了 URL 。




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org