Created attachment 24111 [details] exception 1 Errors appeared after stopping and starting tomcat.
Created attachment 24112 [details] exception 2
Created attachment 24113 [details] exception 3
We use tomcats for hosting web services. Because the NPEs a web service client resends the soap message. The calls are processed two times, which cause failures. Restarting tomcat can solve the issue, but not always. First occured after a normal restart, there were no changes in the deployed applications. To contact us please use the provided e-mail address. Regards, Bertalan Kis
That looks very much like the application is holding onto a copy of the response object and trying to use it when Tomcat thinks the request is complete and has recycled the response object for use with a following request. Try setting the system property: org.apache.catalina.connector.RECYCLE_FACADES=true This forces the facades to be recycled more thoroughly. You'll probably still see NPEs but they should occur where a request/response is used in an invalid manner.
Thanks for the advice. We will try this option, but it will need to go through our release process, which is slow. It can be released in several weeks from now.
No response in three months, assume it was an app issue.
Sorry for not updating the ticket. As I mentioned there is a very slow release process here. We could apply the suggested org.apache.catalina.connector.RECYCLE_FACADES=true system property last thursday. Unfortunatelly it wasn't solved the issue, we see the same excpetions in the logs.
As per #4 this still looks like an app issue rather than a Tomcat one. Please follow up on the users list. You'll want to include an up to date stack trace.
Looking at all the three stack traces (from the Description and Comment 1, Comment 2), all of them occur only if in MimeHeaders class methods headers[i] occurs to be null. That is particularly visible from the third stack trace, that points to org.apache.tomcat.util.http.MimeHeaders.clear(MimeHeaders.java:130) MimeHeaders.headers[i] equal to null can be only if MimeHeaders.count has a wrong value, or if a new MimeHeaderField was assigned to a wrong cell in the array, or to a wrong array when the array was expanded. That can only occur if MimeHeaders.createHeader() or MimeHeaders.removeHeader(int) were called concurrently by multiple threads. MimeHeaders class is not safe for multithreading. Therefore response.setHeader(...), response.addHeader(...) methods are not thread-safe. Thus, if several threads add/set headers asynchronously, you will see this error. This behavior conforms to the specification - see chapter SRV.2.3.3.3 in Java Servlet Specification 2.5. It says "Implementations of the request and response objects are not guaranteed to be thread safe."