ywf4026 edited a comment on issue #2132:  Does Motan plugin support 
cross-thread call?
URL: 
https://github.com/apache/incubator-skywalking/issues/2132#issuecomment-454689934
 
 
   > > But I found another problem, if thread A call thread B and thread B call 
thread C, I can not find the span of B called C.
   > 
   > This plugin only works if thread c created in thread b. If you are using a 
thread pool, you have to understand the Context#capture and Context#continued 
in our plugin APIs. Then make the context propagates across thread b-c
   
   @wu-sheng I got a question.
   
   I use skywalking 6.0.0.beta, mysql as storage, standalone
   
   My code like this:
   
   `@TraceCrossThread
   Class GetPartScore implements Callable;
   
   Class GetMidFeature implements Callable{
       public void call(){
               featureServiceMotan.getMidsFeaturesWithRequestId();
       }
   }
   
   Thread A:
   ExecutorService executorService = Executors.newFixedThreadPool(1);
   executorService. submit(new GetPartScore());
   
   Thread B:
   ExecutorService executorService = Executors.newFixedThreadPool(1);
       executorService.submit(CallableWrapper.of(new GetMidFeature()));
   
   Thread C:
   execute GetMidFeature task
   
   The trace graph is:
   
![image](https://user-images.githubusercontent.com/3722641/51233800-d972fa00-19a5-11e9-9f19-9e5c334f914d.png)
   
   table segment adds two records
   
![image](https://user-images.githubusercontent.com/3722641/51233963-57370580-19a6-11e9-939d-29d821f3747a.png)
   
   table endpoint_inventory adds four records
   
![image](https://user-images.githubusercontent.com/3722641/51234583-14762d00-19a8-11e9-8eee-00a2e1196f94.png)
   
   
   
   The trace graph is not correct, I think it should be:
   
![image](https://user-images.githubusercontent.com/3722641/51234073-a846f980-19a6-11e9-977e-160b9fff1f58.png)
   
   I  debug , the problem may be in the preBuild step :
   
   ReferenceIdExchanger class#line 75:
   
![image](https://user-images.githubusercontent.com/3722641/51234268-3ae79880-19a7-11e9-9ab3-f4c651a6dd5a.png)
   
   In table endpoint_inventory, the GetPartScore endpoint's detect_point is 3, 
but above code uses DetectPoint.SERVER.ordinal(), that is 0, So the 
parentEndpointId(=GetPartScore) can't be found, then the last sement parse fail.
   
   If I change the value of the detect_point of the GetPartScore endpoint to 0, 
then the trace graph is right:
   
![image](https://user-images.githubusercontent.com/3722641/51234073-a846f980-19a6-11e9-977e-160b9fff1f58.png)
   
   
   Is this my  code problem?
   
   Thanks for your help
   
   
   
   
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to