On 13/06/2011 16:07, Rainer Jung wrote:
> I had some spare time for analyzing the crashes in
> TestMapperWelcomeFiles. It seems there are several varieties, but at
> least I do now understand enough to report here:
> 
> In Http11AprProcessor.process() when parsing the request line fails,
> e.g. it is not yet there, we add the socket back to the poller. Then we
> check the endpoint for being paused. If so, we set "error" to true.
> 
> At the end of process(), if "error" is true, we return
> SocketState.CLOSED, which in turn lets the SocketProcessor closes the
> socket (and destroys the native memory allocated with it).
> 
> Now what I experience sporadically, is that the original thread A is
> thrown off the CPU after adding the socket back to the poller, but
> before proceeding.
> 
> Another thread B now gets the socket from the poller, uses it for
> request processing and at the end destroys it. Now A wakes up and
> proceeds as described above, and since now the endpoint is paused, it
> also tries to destroy the socket, leading to a crash.
> 
> This seems to be a flaw. I suggest we add only to the poller if we know
> no error occured and the endpoint is not paused. The patch for AjpApr is
> simpler but similar. See for both classes:
> 
> http://people.apache.org/~rjung/patches/tc7-apr-add_to_poller.patch
> 
> I checked this patch against one full run of the test suite with HTTP
> APR and also against 150 runs of TestMapperWelcomeFiles. No crashes or
> errors any more.
> 
> WDYT?

Analysis and patch make sense to me.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to