Bug 48795 - Tomcat tries to use cache when compilation failed
Summary: Tomcat tries to use cache when compilation failed
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.24
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-22 15:13 UTC by apache
Modified: 2010-05-18 14:49 UTC (History)
0 users



Attachments
Full error log. (4.09 KB, text/plain)
2010-02-22 15:13 UTC, apache
Details

Note You need to log in before you can comment on or make changes to this bug.
Description apache 2010-02-22 15:13:26 UTC
Created attachment 25037 [details]
Full error log.

After compilation of a JSP fails, Tomcat will often still try to use the (non-existant) cached version.

For example, I have a simple JSP containing only "Hello, <%=name%>".
When accessing for the first time, Tomcat throws "org.apache.jasper.JasperException: Unable to compile class for JSP".

Subsequent requests will alternate between this error, and "java.lang.ClassNotFoundException: org.apache.jsp.jsp.test_jsp".

In the case of editing existing JSPs which have compiled fine, the response will alternate between the original error, and the cache of the last-good JSP.

I'm using Sun JVM 1.6.0_18-b07.
Comment 1 Mark Thomas 2010-03-10 17:37:48 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2010-03-11 20:39:50 UTC
After some discussion, a modified patch has been applied and proposed.

The issue is that immediately re-trying the compilation increases the risk of a DOS attack. Whilst JSP compilation failures shouldn't happen in production, they often do.

The new approach adds a new init parameter for the JSP servlet that controls if failed compilations are immediately retried on the next access or if modificationTestInterval is honour. This only applies in development mode.

For versions where this feature is not available, consider setting modificationTestInterval to 0. Again the same warning re DOS applies.
Comment 3 apache 2010-03-12 14:22:46 UTC
Thanks for following up on this issue.

Does the proposed patch also address the case when a JSP has compiled and cached successfully and is subsequently edited with some syntax error? In this situation Tomcat seems to not invalidate the cache.
Comment 4 Mark Thomas 2010-05-18 14:49:02 UTC
This has been fixed in 6.0.x and will be included in 6.0.26 onwards.