Handling Exceptions when Closing

frankb fedora at barber-family.id.au
Mon Jun 20 23:48:53 EDT 2011


Hi Trustin,

I found this problem during unit testing.  An AssertionError was caught by
DefaultChannelPipeline.sendDownstream(), and the test just froze waiting
untinterruptibly for the channel to close.

In my application I have a handler that provides hooks so that the rest of
the system can respond as it pleases to closing channels.  Perhaps your
point is that these should be fired on another thread?

Nonetheless, I'm trying to write a robust application. It seems unreasonable
to me just to presume that an unexpected exception is never going to be
thrown.  I could catch(Throwable) in each of my handlers, but the pipeline
already does this for me.  It just isn't providing enough context for me to
handle the problem properly.

Two things I can think of that would help are as follows.

Firstly, the ExceptionEvent could include the event that was being processed
when the exception occured.

Secondly, the ChannelSink could fail the future prior firing the exception,
similar to what is done during connect.

I'm happy to try to put a patch together if I get some time over the next
week.

Thanks,
Frank.

--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Handling-Exceptions-when-Closing-tp6483461p6498626.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list