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

Cleanup ThreadContext in finally-clause #294

Merged
merged 2 commits into from
Aug 1, 2016

Conversation

jgogstad
Copy link
Contributor

Fixes #292

@msftclas
Copy link

Hi @jgogstad, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;

@OriYosefiMSFT
Copy link
Member

Thanks for contributing the solution. I understand the issue you are reporting but I'm concerned that the proposed code may have an issue as well.
webModulesContainer.invokeOnEndRequest would invoke the module's OnEndRequest which uses the TLS (e.g. here ).
After the proposed changed, the TLS would have already been cleaned up in the "finally" clause.

@@ -181,10 +182,6 @@ private boolean invokeSafeOnBeginRequest(ServletRequest req, ServletResponse res
private void invokeSafeOnEndRequest(ServletRequest req, ServletResponse res) {
try {
webModulesContainer.invokeOnEndRequest(req, res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call invokes the modules' onEndRequest method which uses the TLS. After cleanup above, the TLS would no longer be available

@jgogstad
Copy link
Contributor Author

jgogstad commented Aug 1, 2016

True, sorry for the lack of proper testing on my part. Pushed a fix that also addresses #298. I restructured the conditionals a bit in order to make the exception handling more readable. As long as you're targeting JRE 1.6, we can't collapse the catch-blocks so the code is duplicated.

@gupele
Copy link
Contributor

gupele commented Aug 1, 2016

Thanks for the fix!

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

Successfully merging this pull request may close these issues.

4 participants