Digging into the root causes of [1] it appears that there are a number
of threading / timing issues with the current AsyncContextImpl. Running
the provided test case with ab -n 50 -c 20 triggers the error every
couple of runs. The error appears to occur when the thread where
complete() is called finishes before the thread where startAsync() is
called.

There were a number of places / ways this could happen:
- the checks if current state are not thread safe
- the state changes are atomic but the actions that are part of that
state were not atomic
- the spec requirement the complete() and dispatch() must wait until the
thread where startAsync() is called completes are not met
- socket level processing is handled by the executor so there is no
guarantee of processing order

I had a couple of false starts trying to fix this but my current attempt
[2] is showing some promise. The test case from [1] runs without error
with ab -n 5000 -c 400 with or without -k.

At the moment [2] is in a very rough and ready state and only handles
startAsync() and complete() for the BIO HTTP connector. I wanted to give
folks early sight of this patch so I could incorporate any early feedback.

I plan to expand the patch to cover dispatch(), timeouts, the other
connectors, passing our test cases and passing the TCK before
committing. I'm not sure how long that will take. I hope to get this
done this week.

Mark

[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=49884
[2]
http://people.apache.org/~markt/patches/2010-09-12-async-refactoring.patch

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

Reply via email to