(In reply to comment #2)
> The state changes in AsyncContextImpl aren't atomic so I think what you are
> seeing is the result of multiple parallel calls to doInternalComplete(). Am I
> correct in thinking this error is fairly rare?
Yes, it is rare. The reason I reported this is that I'm load testing this servlet (well, my real servlet, but this one just to repro the problem), and every once in a while I get a 200 or 500 response that takes over 10 seconds whereas the average is half a second (using AccessLogValve %D to see this). I ran with tracing and noticed this NPE and thought maybe it's somehow related to the sporadic long request, but I don't know if it's root cause. Also, it is preceded by the "TIMING OUT!" entry, so maybe this NPE is just a side effect of the timeout?

I've been able to spend some time looking at this. It is very easy to reproduce on a multi-core machine with relatively low numbers of requests and concurrency.
There is definitely a threading issue at the heart of this. I need to dig deeper to find out exactly what the root cause is.

(In reply to comment #4)
> I've been able to spend some time looking at this. It is very easy to reproduce
> on a multi-core machine with relatively low numbers of requests and
> concurrency.
>
> There is definitely a threading issue at the heart of this. I need to dig
> deeper to find out exactly what the root cause is.
Thanks Mark.

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.