You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2008/07/11 11:26:32 UTC

[jira] Updated: (HTTPCORE-165) Poor handling of CancelledKeyException with custom IOReactorExceptionHandler

     [ https://issues.apache.org/jira/browse/HTTPCORE-165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-165:
---------------------------------------

    Attachment: cancelledkey.patch

Patrick, 

How about the following patch? Could you please test it with your app?

Oleg

> Poor handling of CancelledKeyException with custom IOReactorExceptionHandler 
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-165
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-165
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-beta2
>            Reporter: Patrick Moore
>         Attachments: cancelledkey.patch
>
>
> IOReactorExceptionHandler documentation for handle(RuntimeException ex) is misleading. Specifically the documentation says :
>      @return <code>true</code> if it is safe to ignore the exception 
>      and continue execution of the I/O reactor; <code>false</code> if the
>      I/O reactor must throw {@link RuntimeException} and terminate 
> However, a CancelledKeyException should be rethrown because the BaseIOReactor and the AbstractIOReactor expect and handle CancelledKeyException correctly.
> BUT -- NOT always.
> Looking at the call stack for where IOReactorExceptionHandler.handle(RuntimeException) is called reveals some problems.
> If a custom IOReactorExceptionHandler was to return false (indicating that the CanceledKeyException was to be rethrown or to do the rethrow itself) WOULD result in the IOReactor being shutdown:
>   BaseIOReactor.sessionClosed(IOSession)
>   BaseIOReactor.timeoutCheck(SelectionKey, long)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org