Bug 57845 - Multiple JspServletWrapper's sharing one JspCompilationContext
Summary: Multiple JspServletWrapper's sharing one JspCompilationContext
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 7.0.56
Hardware: PC Linux
: P2 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2015-04-22 07:18 UTC by j__n
Modified: 2015-04-24 03:25 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description j__n 2015-04-22 07:18:52 UTC
Copied from http://stackoverflow.com/questions/24567224/tomcat-serving-cached-alias:

Setup:  One jsp served at multiple urls:


When I change the contents of index.jsp and visit /, it is updated.  Then when I visit /advanced/ it is not updated.  I expect both URL's contents to be updated.  If I change index.jsp again and visit /advanced/ first, it is up-to-date, but / is not.

I spent some time in org.apache.jasper.compiler.Compiler#isOutDated(boolean), and I've found that only the first URL that I visit is the one that is marked outDated. The second URL I visit is never marked outDated. So it's as if tomcat keeps two instances of JspServlet but share the same outDated information for the file, so when one JspServlet marks it as outDated and sets reload, the second JspServlet never recompiles it nor serves the recompiled version.

(Also happened in 7.0.47 and some earlier versions of Tomcat7.  Never tried it on Tomcat6 or 8.)
Comment 1 Mark Thomas 2015-04-23 09:02:43 UTC
This is strange. Thanks for the report, I'm looking into this now. I can reproduce this with Tomcat trunk (9.0.x) so this looks like a bug somewhere in Jasper. I suspect it affects all current Tomcat versions.

Once I figure out, why this is happening, I should be able to put a patch together to fix it.
Comment 2 Mark Thomas 2015-04-23 13:00:43 UTC
Thanks for the report. This has been fixed in trunk (9.0.x), 8.0.x/trunk (for 8.0.22 onwards) and 7.0.x/trunk (for 7.0.62 onwards).
Comment 3 j__n 2015-04-24 03:25:43 UTC
Thanks Mark!