Skip to content
Permalink
Browse files
Merge pull request #1453, restore the bug that attachment has not bee…
…n updated in the RpcContext when the Dubbo built-in retry mechanism is triggered.
  • Loading branch information
manzhizhen authored and chickenlj committed Jun 5, 2018
1 parent 7df5eb6 commit 42ba20ed43331f0e3e1c4a4ea75fcb34f564b796
Showing 1 changed file with 8 additions and 1 deletion.
@@ -136,7 +136,14 @@ public Result invoke(Invocation inv) throws RpcException {
}
Map<String, String> context = RpcContext.getContext().getAttachments();
if (context != null) {
invocation.addAttachmentsIfAbsent(context);
/**
* invocation.addAttachmentsIfAbsent(context){@link RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
* because the {@link RpcContext#setAttachment(String, String)} is passed in the Filter when the call is triggered
* by the built-in retry mechanism of the Dubbo. The attachment to update RpcContext will no longer work, which is
* a mistake in most cases (for example, through Filter to RpcContext output traceId and spanId and other information).
* yizhenqiang 20180310
*/
invocation.addAttachments(context);
}
if (getUrl().getMethodParameter(invocation.getMethodName(), Constants.ASYNC_KEY, false)) {
invocation.setAttachment(Constants.ASYNC_KEY, Boolean.TRUE.toString());

0 comments on commit 42ba20e

Please sign in to comment.