On 09/06/17 12:41, Mark Thomas wrote:
> On 05/06/17 09:38, Violeta Georgieva wrote:
> 
> <snip/>
> 
>> Try with this test
>> https://github.com/violetagg/tomcat/commit/53564d4e73496cb3badcaaab81a1314cf2ed750d
> 
> Thanks. That clarifies things a lot.
> 
> It boils down to what should happen when an I/O error occurs reading
> from the request or writing to the response on an non-container thread.

<snip/>

> I'm currently on the fence between calling this an application error
> (the non-container thread should not call dispatch after an I/O error)
> and trying to figure out if there is a way we could handle this.
> 
> I'm currently looking at the code to see what the options might be. Did
> you have a patch in mind? We also need to be careful that we don't end
> up with multiple container threads trying to handle the same async request.

I've spent some time working through the various possible combinations
of events and have concluded it is impossible to completely fix this
without imposing additional requirements on applications that the
specification doesn't mention.

However, I believe that we can do better than the current
implementation. What I have on mind would:

- always trigger AsyncListener.onError() for all listeners
- generally, process the complete() dispatch() call from the
  AsyncListener rather than any from the non-container thread
- generally, throw an ISE if complete() or dispatch() is called
  from the non-container thread after that thread experiences an I/O
   error
- leave a small timing window where it was possible that the complete()
  or dispatch() from the non-container thread would be used rather than
  from the AsyncListener. In that case the AsyncListener would see the
  ISE but any remaining AsyncListener instances would still be called

I don't see a way of doing better than this without spec changes /
clarifications.

WDYT?

Mark

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

Reply via email to