File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,14 @@ public Result invoke(Invocation inv) throws RpcException {
136136 }
137137 Map <String , String > context = RpcContext .getContext ().getAttachments ();
138138 if (context != null ) {
139- invocation .addAttachmentsIfAbsent (context );
139+ /**
140+ * invocation.addAttachmentsIfAbsent(context){@link RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
141+ * because the {@link RpcContext#setAttachment(String, String)} is passed in the Filter when the call is triggered
142+ * by the built-in retry mechanism of the Dubbo. The attachment to update RpcContext will no longer work, which is
143+ * a mistake in most cases (for example, through Filter to RpcContext output traceId and spanId and other information).
144+ * yizhenqiang 20180310
145+ */
146+ invocation .addAttachments (context );
140147 }
141148 if (getUrl ().getMethodParameter (invocation .getMethodName (), Constants .ASYNC_KEY , false )) {
142149 invocation .setAttachment (Constants .ASYNC_KEY , Boolean .TRUE .toString ());
You can’t perform that action at this time.
0 commit comments