You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Geir Harald Hansen (JIRA)" <ji...@apache.org> on 2011/09/04 03:45:09 UTC

[jira] [Created] (HTTPCORE-272) AsyncNHttpServiceHandler does not react when long polling clients disconnect

AsyncNHttpServiceHandler does not react when long polling clients disconnect
----------------------------------------------------------------------------

                 Key: HTTPCORE-272
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-272
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore NIO
    Affects Versions: 4.1.3
            Reporter: Geir Harald Hansen
            Priority: Minor


When using NHttpRequestHandler and in its handle() method storing the NHttpResponseTrigger and HttpResponse for later, to implement long polling, AsyncNHttpServiceHandler does not react when clients disconnect. It does react (its close() method is invoked) if other connections are closed, though. Its close() method is also called later when trying to write to the connection.

Order of events:
1. NHttpRequestHandler.handle() invoked, trigger and response stored
2. Client disconnects - connection goes to CLOSE_WAIT
3. Connection goes out of CLOSE_WAIT and disappears
4. After a few minutes I try to use the NHttpResponseTrigger to send a response
5. Now AsyncNHttpServiceHandler reacts and tells me the connection has closed

It would be useful if AsyncNHttpServiceHandler was told of closed connections immediately so resources are not wasted preparing data for clients that are no longer there.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Resolved] (HTTPCORE-272) AsyncNHttpServiceHandler does not react when long polling clients disconnect

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-272.
----------------------------------------

    Resolution: Fixed

Geir,

Protocol API in HttpCore has undergone a thorough redesign. The old API and implementation classes had been deprecated and new implementations added to supersede deprecated ones. The good news is the new API provides a facility to cancel long running asynchronous request handlers. The new async request handler can optionally return a Cancellable instance from the #handle method [1]. This enables the protocol handler to cancel the request handling process if the handler is no longer expected to produce a result, for instance, due to the opposite endpoint closing the connection. 

Please have a look at the new API and let me know if it addresses the issue for you. Feedback will be highly appreciated.

Oleg

[1] http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestHandler.java

> AsyncNHttpServiceHandler does not react when long polling clients disconnect
> ----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-272
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-272
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.3
>            Reporter: Geir Harald Hansen
>            Priority: Minor
>             Fix For: 4.2-alpha2
>
>
> When using NHttpRequestHandler and in its handle() method storing the NHttpResponseTrigger and HttpResponse for later, to implement long polling, AsyncNHttpServiceHandler does not react when clients disconnect. It does react (its close() method is invoked) if other connections are closed, though. Its close() method is also called later when trying to write to the connection.
> Order of events:
> 1. NHttpRequestHandler.handle() invoked, trigger and response stored
> 2. Client disconnects - connection goes to CLOSE_WAIT
> 3. Connection goes out of CLOSE_WAIT and disappears
> 4. After a few minutes I try to use the NHttpResponseTrigger to send a response
> 5. Now AsyncNHttpServiceHandler reacts and tells me the connection has closed
> It would be useful if AsyncNHttpServiceHandler was told of closed connections immediately so resources are not wasted preparing data for clients that are no longer there.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (HTTPCORE-272) AsyncNHttpServiceHandler does not react when long polling clients disconnect

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-272:
---------------------------------------

    Fix Version/s: 4.2-alpha2

> AsyncNHttpServiceHandler does not react when long polling clients disconnect
> ----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-272
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-272
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.3
>            Reporter: Geir Harald Hansen
>            Priority: Minor
>             Fix For: 4.2-alpha2
>
>
> When using NHttpRequestHandler and in its handle() method storing the NHttpResponseTrigger and HttpResponse for later, to implement long polling, AsyncNHttpServiceHandler does not react when clients disconnect. It does react (its close() method is invoked) if other connections are closed, though. Its close() method is also called later when trying to write to the connection.
> Order of events:
> 1. NHttpRequestHandler.handle() invoked, trigger and response stored
> 2. Client disconnects - connection goes to CLOSE_WAIT
> 3. Connection goes out of CLOSE_WAIT and disappears
> 4. After a few minutes I try to use the NHttpResponseTrigger to send a response
> 5. Now AsyncNHttpServiceHandler reacts and tells me the connection has closed
> It would be useful if AsyncNHttpServiceHandler was told of closed connections immediately so resources are not wasted preparing data for clients that are no longer there.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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