You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/05/09 05:13:26 UTC

[GitHub] [skywalking] liudantop opened a new issue #2637: pring MVC/Tomcat plugin can not output tracing data if current request is forward request.

liudantop opened a new issue #2637: pring MVC/Tomcat plugin can not output tracing data if current request is forward request.
URL: https://github.com/apache/skywalking/issues/2637
 
 
   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [ 1] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   
   ___
   ### Bug
   - Which version of SkyWalking, OS and JRE?
   6.1.0
   Jdk8
   win10
   Springboot 1.5
   - Which company or project?
   
   - What happen?
   If possible, provide a way for reproducing the error. e.g. demo application, component version.
   In scenario:
   1.have a API "/test_forward"
   2.API "/test_forward" mapping method will forward to the URL "/error_proto"
   
   It can not generate tracing span data.
   
   demo code:
   import javax.servlet.RequestDispatcher;
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import java.io.IOException;
   
   @RestController
   public class Rest02 {
       @GetMapping("/test_forward")
       public void test_forward(HttpServletRequest request,
                                HttpServletResponse response) {
           RequestDispatcher dispatcher = request.getRequestDispatcher("/error_test");
           try {
               dispatcher.forward(request, response);
           } catch (ServletException e) {
               e.printStackTrace();
           } catch (IOException e) {
               e.printStackTrace();
           }
       }
   
       @GetMapping("/error_test")
       public String error_proto(){
           return "error test";
       }
   }
   
   
   debug agent stack:
   I find that activeSpanStack is not empty in TracingContext, becuase step6 direct return, then stackDepth = 1 in step7 stopSpan,  so it can not finsh:
   1: TomcatInvokeInterceptor(tomcat plugin) > before method
   -----2: AbstractMethodInterceptor(spring plugin) > before method
   ----------3: ForwardInterceptor(tomcat) > before(set forward flag)
   ---------------4: AbstractMethodInterceptor > before method(because forward flag then return )
   ---------------5: AbstractMethodInterceptor > after method(because forward flag then return )
   -----6: AbstractMethodInterceptor > after method(because forward flag then return )
   7: TomcatInvokeInterceptor(tomcat plugin) > after method
   
   ___
   ### Requirement or improvement
   - Please describe about your requirements or improvement suggestions.

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


With regards,
Apache Git Services