On Sun, 2011-08-07 at 23:34 +0200, Oleg Kalnichevski wrote: > On Sun, 2011-08-07 at 14:05 -0400, James Leigh wrote: > > Hi hc, > > > > We have been developing with httpcore for almost 18 months and have been > > really happy with it. However, as we push to have more public facing Web > > server running httpcore we are concerned about abnormal client > > behaviour. > > > > In the unusual event that an IOReactor throws an exception how can we > > have the current connection closed without affecting the rest of the > > server? > > > > This can happen in an SSL connection, when the server does not have the > > algorithm used by the client or the client does not follow the > > specification properly. It can also happen in unencrypted connections > > when something unexplained happens with the buffers, like the stack > > trace below. > > > > I know that an IOReactorExceptionHandler can be used to distinguish > > between fatal and ignorable exceptions. However, fatal exceptions > > (re-thrown) seem to hang the server and ignored exceptions don't closed > > the connection (so says the javadoc). > > > > What is the best way to indicate that the TCP connection should be > > closed (not the IOReactor) on unexpected exceptions? > > > > Hi James > > Usually protocol handlers are expected to handle all recoverable > exceptions including non-checked (runtime) ones. All events triggered by > the I/O reactor and propagated to the protocol handler take place in a > context of a particular connection, so one can always choose to shut > down the connection if the exception can be recovered from. Those > exceptions that are not handled by the protocol handler or thrown by the > I/O reactor itself usually represent a programming error and therefore > considered non-recoverable (fatal). In those cases the best course of > action would be to let the I/O reactor shut down itself and be > restarted. >
So, by letting the exception propagate, the i/o reactor is expected to be restarted. What class is responsible for restarting the i/o reactor? I will run some more tests late next week and try and follow up with a reproducible scenario to demonstrate a non-checked exception that is not a programming error. > > > Caused by: java.lang.IllegalArgumentException > > at java.nio.Buffer.limit(Buffer.java:249) > > at > > org.apache.http.impl.nio.codecs.LengthDelimitedDecoder.read(LengthDelimitedDecoder.java:95) > > The IllegalArgumentException thrown inside LengthDelimitedDecoder > appears to be a bug in HttpCore, which need to be fixed. I do not think > there is a reasonable way of recovering from such exceptions. > > Is there a way to reproduce it? Are you using the latest version of > HttpCore? > > Cheers > > Oleg > No, the exception was not with the latest version and I think this bug has since been fixed in later versions of httpcore. James --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
