----- Original Message ----- > From: "Mark Thomas" <ma...@apache.org> > To: "Tomcat Users List" <users@tomcat.apache.org> > Sent: Thursday, April 25, 2013 8:42:55 AM > Subject: Re: AsyncListener.onError and disconnected client
> It is. The issue is when is happens. > > The issue is that there is no event (I am aware of) that the > container > can monitor. > > BIO - Only know once a read/write fails. > > NIO - A current read/write will fail. > The socket can be explicitly tested (but isn't currently) > If the socket is in the poller I'd expect an error event > If the socket was added to the poller I'd expect an error event > > APR - A current read/write will fail. > If the socket is in the poller I'd expect an error event > If the socket was added to the poller I'd expect an error event > It might be possible to test the socket but I haven't checked > > There are times when a socket is not being used for read/write and is > not in a poller (e.g. when the app is doing some processing that > doesn't require output to the user agent). You won't get a notification of > disconnect in this case until the app has finished. > > I wonder (for NIO and APR) if you could always have the socket in the > poller in order to detect a disconnect? Would it be feasible to test sockets periodically? I can imagine some such logic is used to track async request timeouts. Possibly not all sockets, but only the ones in async mode, which should be a smaller subset. Since the recommended time for long poll duration is around 30 seconds, checking every 5 seconds would go a long way. Of course if keeping the socket in the poller is possible, instant detection (as with WebSockets) would be ideal. > This really comes down to how the spec has been written. onError is > for errors that happen in the container during dispatch (i.e. at the end > of the async phase) that the app does not have visibility of. It allows > the container to tell the app that the request did not complete normally. > It is not intended for IO errors that happen during the async phase > which the app can just catch. Thanks for all the explanations! Rossen --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org