You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "cinbo-github (GitHub)" <gi...@apache.org> on 2019/03/08 06:56:53 UTC
[GitHub] [incubator-dubbo] cinbo-github opened issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
- [ ] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this repository and believe that this is not a duplicate.
- [ ] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: 2.6.6
* Operating System version: MacOS 10.14.3
* Java version: 1.8.0_171
### Steps to reproduce this issue
When I try to use RpcContext.getServerContext to pass data from provider to cusumer,if the method runs in sync mode, it works( Provider uses RpcContext.getServerContext().setAttachment to set Key-Value data,then Consumer uses RpcContext.getServerContext().getAttachment to get the Key-Value Data.). But if the method runs in async mode, it doesn't works. Consumer can't get the Key-Value by RpcContext.getServerContext().getAttachment.
1.
2. xxx
3. xxx
Pls. provide [GitHub address] to reproduce this issue.
### Expected Result
What do you expected from the above steps?
### Actual Result
What actually happens?
If there is an exception, please attach the exception trace:
```
Just put your stack trace here!
```
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
sorry, I didn't intend to edit your reply, it is a misoperation
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] lizanle521 commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "lizanle521 (GitHub)" <gi...@apache.org>.
@tswstarplanet yes,i did it yesterday . and i doubted it also .but it is not the cause .
as i said bebore, before RpcContext.removeContext , invoker.invoke return a AsyncRpcResult object.
that object hold a copy of serverConext .
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
@lizanle521 You can debug it
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] lizanle521 commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "lizanle521 (GitHub)" <gi...@apache.org>.
@tswstarplanet the thing i want to say is, nomatter scene you test, RpcContext clear it's threadlocal param
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
Can you pls provide a demo to reproduce the problem ?
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] cinbo-github closed issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "cinbo-github (GitHub)" <gi...@apache.org>.
[ issue closed by cinbo-github ]
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] lizanle521 commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "lizanle521 (GitHub)" <gi...@apache.org>.
@tswstarplanet yes,i did it yesterday . and i doubted it also .but it is not the cause .
as i said bebore, before RpcContext.removeContext , invoker.invoke return a AsyncRpcResult object.
that object hold a copy of serverConext .
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] cinbo-github commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "cinbo-github (GitHub)" <gi...@apache.org>.
the issue still exists
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] chickenlj commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "chickenlj (GitHub)" <gi...@apache.org>.
Thanks for reporting, I can reproduce from the official sample 'dubbo-samples-async-original-future', will try to figure it out.
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] lizanle521 commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "lizanle521 (GitHub)" <gi...@apache.org>.
> The ContextFilter will remove ServerContext after invoke. So the attachments are removed.
are you sure about this ? i don't think so . invoker.invoke returns AyncRpcResult first. then RpcContext clear it's context .
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
I just test the sync invoke
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
I find this problem also exists in sync mode. It is because the code following:
ContextFilter.java
![image](https://user-images.githubusercontent.com/3047563/54224548-b5124480-4534-11e9-97e4-f3f12af623c5.png)
The ContextFilter will remove ServerContext after invoke. So the attachments are removed.
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3620: cusumer设置使用异步调用方法时,RpcContext中的ServerContext参数,无法从provider传到cusumer
Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
I just test the sync invoke
@tswstarplanet yes,i did it yesterday . and i doubted it also .but it is not the cause .
as i said bebore, before RpcContext.removeContext , invoker.invoke return a AsyncRpcResult object.
that object hold a copy of serverConext .
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3620 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org