On 25/11/2013 17:39, Daniel Mikusa wrote:
> On Nov 25, 2013, at 12:19 PM, "Caldarale, Charles R"
> <chuck.caldar...@unisys.com> wrote:
> 
>>> From: Daniel Mikusa [mailto:dmik...@gopivotal.com] Subject:
>>> Another Non-blocking IO Question
>> 
>>> Most of the time it works, but in one case I'm seeing requests
>>> hang.
>> 
>> You know the ritual:
>> 
>> 1) Tomcat version? 2) JDK version? 3) Thread dump?
> 
> Doh… Tomcat trunk.  JDK 1.7.0_45.
> 
> Took some thread dumps, but I don't think that's going to help here.
> There are no blocking threads or threads waiting on external
> resources.  The issue is that the async context is not being closed
> and, in my example this is not happening cause "onAllDataRead()" is
> not being called.  Which back to my question, can I depend on
> "onAllDataRead()" being called always or are there certain cases
> where it won't get called?

You should be able to rely on onAllDataRead() being called.

>>> in this case "onWritePossible" (i.e. my WriteListener) is reading
>>> the data.
>> 
>> That seems to be against the spirit of the spec, albeit not the
>> letter.  Spec clarification might be needed here.

The nature of the Servlet 3.1 non-blocking API is such that if copying
data from request to response that the entire body may be read and the
entire response written without any calls to onDataAvailable() or
onWritePossible(). (That case is handled.). Depending on network
conditions you may see either or both of onDataAvailable() and
onWritePossible().

The code doesn't currently handle it correctly if the request is
finished during onWritePossible(). I need to add that but it is a little
more complicated as there could be multiple onWritePossible() calls
after the request has been finished.

Your test case would be very helpful.

Mark

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

Reply via email to