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

RpcContext's ServerContext can not transform data from provider to consumer when using sync invoke mode #3662

Closed
2 tasks
tswstarplanet opened this issue Mar 14, 2019 · 13 comments
Assignees

Comments

@tswstarplanet
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.x
  • Operating System version: MacOS
  • Java version: 1.8

Steps to reproduce this issue

  1. Execute following code in a method of a dubbo service on provider side:
RpcContext.getServerContext().setAttachment("abc", "123");
  1. Execute following code in the same thread that invoke the remote dubbo service after the invoking:
Map<String, String> map = RpcContext.getServerContext().getAttachments();
System.out.println("context: " + map.get("abc"));

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

Console output:
context: 123

Actual Result

context: null

What actually happens?

If there is an exception, please attach the exception trace:

Just put your stack trace here!
@tswstarplanet
Copy link
Contributor Author

#3664

@carryxyh
Copy link
Member

I think your pr will cause new problems.
@chickenlj Would you like to check this pr twice?

By the way, why create a new issue. Focus on #3620?

@tswstarplanet
Copy link
Contributor Author

Because this pr cannot solve the problem when using async invoke

@carryxyh
Copy link
Member

But it will cause another problem.
Pls check my comment under your pr.

@tswstarplanet
Copy link
Contributor Author

I am not sure if the remove operation of servercontext that is execute in the onResponse method is equal to be executed in the invoke method.

@carryxyh
Copy link
Member

of course not....
The two are not equal..

Since this pr can't fix the problem, I think we can close this issue and focus on #3620. What do u think

@tswstarplanet
Copy link
Contributor Author

I think it is two problems, one is sync invoke, the other is async. We can remains them both, or merge to one

@carryxyh
Copy link
Member

Maybe merge to one is better. We can change the title of #3620 to indicate there are some problems on server context.

@tswstarplanet
Copy link
Contributor Author

OK

@carryxyh
Copy link
Member

hi, @tswstarplanet
I'd like close this issue and pr.
Maybe we need more discuss with it.

@tswstarplanet
Copy link
Contributor Author

I think the pr can be remained. It need some time to test ifit can solve the problem when using sync invoke without impacting async invoke. We donnot need to close one pr so quickly

@chickenlj chickenlj self-assigned this Mar 18, 2019
@cvictory
Copy link
Contributor

cvictory commented May 6, 2019

http://dubbo.apache.org/zh-cn/docs/user/demos/attachment.html

I remember the attachment value is transfered from consumer to provider but not provider to consumer.

@beiwei30 beiwei30 added this to the 2.7.5 milestone Aug 27, 2019
@chickenlj chickenlj modified the milestones: 2.7.5, 2.7.6 Dec 30, 2019
@chickenlj
Copy link
Contributor

I tried both sync and async invoke on 2.7.5, failed to reproduce, I think this issue does not exist or it's been fixed.

@chickenlj chickenlj removed this from the 2.7.6 milestone Feb 2, 2020
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

5 participants