This smells of a static-like object which has a race condition in
handling of requests and responses.
For example - if sessions are used and there is a filter which puts the
current request into the session - that will be a problem.
Another example:
A filter which does user logging/tracking and tracks current requests
per user - but doesn't handle concurrent requests from the same user in
a reliable manner.
-Tim
Tom Davis wrote:
Hi All.
I'm getting some intermittent exceptions from Tomcat with which I would
appreciate some assistance. I get an IllegalStateException from
Tomcat. This is not a unique error, though it looks like the
circumstances causing it are. We have a complex application, with
multiple servlets and many JSPs. The specific type of
IllegalStateException is a TODO, and it usually occurs when we call
sendError() on the HttpServletResponse object. I know this sounds like
the typical coding error, but we have checked very carefully and haven't
found it. We have looked through many of the posts on other occurrences
of this exception, including the Tomcat documentation that describes its
common causes. We've checked those method calls (e.g., getWriter() or
getOutputStream() followed by a sendError() or similar call), and can't
see any logical errors in the flow of code.
The exception only occurs when one specific servlet is active. This
servlet is a custom proxy, and behaves as an Http client to other
servers. Interestingly, the exception doesn't get thrown from the proxy
servlet, it actually pops up in several of the other servlets. We put
in lots of debug statements and found that sometimes (approximately 20%
of the time) the 'isCommitted()' method on the HttpServletResponse
object indicates that the response is already committed *upon entry* to
the proxy servlet! But even when isCommitted() indicates true, it only
occasionally leads to the exception occurring in the other servlets.
It seems that Tomcat is getting confused at the core by the proxy
servlet - why else would the response appear to already be committed
upon entry to our servlet. Possibly this is due to the web client
nature of the proxy servlet? Or maybe a subtle bug somewhere in the
proxy code that overwrites something internally in Tomcat?
We can avoid the IllegalStateException by not calling sendError if the
response is committed, but either way the application doesn't behave
properly.
Environment: We get the same problem on in different environments,
which strongly indicates it is specific to the Tomcat 5.5.X line:
OS: Windows 2000, Windows XP, AIX
JVM: 1.4.2_12-b03 on Win32, J2RE 1.4.2 IBM AIX build ca142-20060824 (SR6)
Tomcat: 5.5.7 and 5.5.20
The Tomcat FAQ lists *the most common* reasons for getting an
IllegalStateException. I think we need to go to the next level. Does
anyone know the more subtle reasons for getting this?
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]