Bug 39126 - on some conditions, tomcat 'forget' an exception
on some conditions, tomcat 'forget' an exception
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.7
All All
: P2 major (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: ErrorMessage
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2006-03-28 09:00 UTC by David Delbecq
Modified: 2008-01-16 16:22 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Delbecq 2006-03-28 09:00:34 UTC
Servlet specs tells the container must redirect to error page in case of 
exception inside jsp. It also allow webapp to provide it's own error handling 
jsp page. Sometimes, because response has already partially been send, tomcat 
is unable to send this redirect. This is somehow a behaviour the coder has to 
expect.

However, when this happen, nowhere in tomcat is the original error logged. All 
you get is:
Exception Processing ErrorPage[exceptionType=java.lang.Exception,
location=/jsp/error.jsp]
java.lang.IllegalStateException
    at org.apache.coyote.Response.reset(Response.java:296)
    at org.apache.catalina.connector.Response.reset(Response.java:642)
    at org.apache.catalina.connector.Response.reset(Response.java:908)
    at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:355)
    at
org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:211)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:134)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:534)

As a conclusion, all the programmer get as information is 'something bad 
occured during process of jsp, but i won't tell you where...' which is really 
useless information!

Solution,
What ever piece of code (errorvalve?) drop the above message in logs should 
also dump in logs the original jsp exception (you can't process the exception 
using an error page? then at least dump it in console)

looks like trivial to implement.
Comment 1 Yoav Shapira 2006-04-13 21:37:09 UTC
You filed this on March 28th 2006, but using 5.5.7.  If you could please try
5.5.16 (a stable and far more recent release), which includes logging
enhancements to show the exact place (specific line) in the source JSP code
causing JSP errors, and let us how that works for you, that would be awesome.
Comment 2 David Delbecq 2006-04-14 11:54:51 UTC
tried with latest tomcat (5.5.16), the situation is even worse.

While in the past you got a error in catalina.out telling the error 
redirection could ne be done (so you had hints sometihng was wrong), now, the 
exception is simply dropped silently!!
i created a simple jsp which does lots of output and then throws a 
JspException.
This JspException is neither visible on screen, neither in catalina.out! The 
only visible symptom is a truncated output of .jsp

I think this now really need fixing.

testcode (test.jsp):
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html"%>
<%@ page language="java" %>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="/tags/struts-logic"   prefix="logic" %>
<html> <body>
test content test content 
test content test content 
... lines and lines and lines of them (.jsp=300k in side)
test content test content 
test content test content 
<% 
    if (1<2)
    throw new JspException("merde");
%>

1234567
</body></html>
Comment 3 Mark Thomas 2008-01-16 16:22:19 UTC
With the current 5.5.25 code you get the following in th elocalhost log so it
looks like this bug has been fixed.

17-Jan-2008 00:15:29 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: merde
	at org.apache.jsp.bug39126_jsp._jspService(bug39126_jsp.java:5672)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:619)