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

Scope should be closed in the method of afterConcurrentHandlingStarted for async request #125

Open
lujiajing1126 opened this issue Jan 13, 2020 · 0 comments

Comments

@lujiajing1126
Copy link

For async requests, thread-bound resources should be cleaned in method afterConcurrentHandlingStarted of TracingHandlerInterceptor interceptor as is suggested in the document AsyncHandlerInterceptor.

In this case, I suppose active scope should be closed since this specific thread will be released back to the dispatch pool and possibly used later for subsequent requests. If the scope is not closed properly, the following requests cannot be traced.

Simply adding the following code at the end of afterConcurrentHandlingStarted makes it work,

Deque<Scope> scopeStack = getScopeStack(httpServletRequest);
if (scopeStack.size() > 0) {
    Scope scope = scopeStack.pop();
    scope.close();
}
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

1 participant