[jira] [Resolved] (HTTPCORE-294) Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()

2012-02-25 Thread Oleg Kalnichevski (Resolved) (JIRA)

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

Oleg Kalnichevski resolved HTTPCORE-294.


   Resolution: Fixed
Fix Version/s: 4.2-beta2

I certainly think that your Cancellable implementation contains logic that 
probably does not belong there. Cancellable should hardly do anything other 
than flipping a flag. Anyway, I removed synchronization on the connection state 
a few days ago and the test case attached to this issue works for me with the 
latest SVN snapshot.

Please re-test with the latest SVN snapshot.

Oleg

> Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()
> 
>
> Key: HTTPCORE-294
> URL: https://issues.apache.org/jira/browse/HTTPCORE-294
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Fix For: 4.2-beta2
>
> Attachments: Test.java, threaddump.txt
>
>
> I leave postponed responses for a separate thread to handle. When 
> Cancellable#cancel() is invoked I signal this background thread and wait for 
> it to signal back before returning true or false from cancel() depending on 
> whether the response was cancelled or already sent. I'm assuming it is not OK 
> to always return true immediately and attempt in the background to signal 
> another thread to tell it to not submit a response, which it may still do if 
> it doesn't get the signal in time.
> My program deadlocks if the background thread tries to submit a response 
> after Cancellable#cancel() has been invoked. The IOReactor worker thread 
> (inside cancel()) waits on the background thread, and the background thread 
> is trying to submit a response, apparently needing a lock held by the 
> IOReactor worker thread.
> Not sure if this is a bug or if I am "doing it wrong". But I think this is a 
> trap many will fall in, so it would be best if this problem could be avoided.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-02-25 Thread Oleg Kalnichevski (Updated) (JIRA)

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

Oleg Kalnichevski updated HTTPCORE-289:
---

Fix Version/s: 4.2-beta2

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Fix For: 4.2-beta2
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Resolved] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-02-25 Thread Oleg Kalnichevski (Resolved) (JIRA)

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

Oleg Kalnichevski resolved HTTPCORE-289.


Resolution: Fixed

I fixed the regression in SVN trunk and also added a test case for such a 
scenario. Please review and re-test. Also feel free to contribute more test 
cases if you can think of other ways of stressing the protocol handler.

Oleg

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-02-25 Thread Geir Harald Hansen (Updated) (JIRA)

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

Geir Harald Hansen updated HTTPCORE-289:


Fix Version/s: (was: 4.2-beta1)

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-02-25 Thread Geir Harald Hansen (Updated) (JIRA)

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

Geir Harald Hansen updated HTTPCORE-289:


Affects Version/s: (was: 4.2-alpha2)
   4.2-beta1

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-294) Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()

2012-02-25 Thread Geir Harald Hansen (Updated) (JIRA)

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

Geir Harald Hansen updated HTTPCORE-294:


Attachment: threaddump.txt
Test.java

Attached example code shows how the deadlock is triggered. Attached thread dump 
shows the two threads locked.

> Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()
> 
>
> Key: HTTPCORE-294
> URL: https://issues.apache.org/jira/browse/HTTPCORE-294
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-beta1
>Reporter: Geir Harald Hansen
> Attachments: Test.java, threaddump.txt
>
>
> I leave postponed responses for a separate thread to handle. When 
> Cancellable#cancel() is invoked I signal this background thread and wait for 
> it to signal back before returning true or false from cancel() depending on 
> whether the response was cancelled or already sent. I'm assuming it is not OK 
> to always return true immediately and attempt in the background to signal 
> another thread to tell it to not submit a response, which it may still do if 
> it doesn't get the signal in time.
> My program deadlocks if the background thread tries to submit a response 
> after Cancellable#cancel() has been invoked. The IOReactor worker thread 
> (inside cancel()) waits on the background thread, and the background thread 
> is trying to submit a response, apparently needing a lock held by the 
> IOReactor worker thread.
> Not sure if this is a bug or if I am "doing it wrong". But I think this is a 
> trap many will fall in, so it would be best if this problem could be avoided.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Created] (HTTPCORE-294) Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()

2012-02-25 Thread Geir Harald Hansen (Created) (JIRA)
Deadlock between Cancellable#cancel() and HttpAsyncExchange#submitResponse()


 Key: HTTPCORE-294
 URL: https://issues.apache.org/jira/browse/HTTPCORE-294
 Project: HttpComponents HttpCore
  Issue Type: Bug
  Components: HttpCore NIO
Affects Versions: 4.2-beta1
Reporter: Geir Harald Hansen


I leave postponed responses for a separate thread to handle. When 
Cancellable#cancel() is invoked I signal this background thread and wait for it 
to signal back before returning true or false from cancel() depending on 
whether the response was cancelled or already sent. I'm assuming it is not OK 
to always return true immediately and attempt in the background to signal 
another thread to tell it to not submit a response, which it may still do if it 
doesn't get the signal in time.

My program deadlocks if the background thread tries to submit a response after 
Cancellable#cancel() has been invoked. The IOReactor worker thread (inside 
cancel()) waits on the background thread, and the background thread is trying 
to submit a response, apparently needing a lock held by the IOReactor worker 
thread.

Not sure if this is a bug or if I am "doing it wrong". But I think this is a 
trap many will fall in, so it would be best if this problem could be avoided.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Reopened] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-02-25 Thread Geir Harald Hansen (Reopened) (JIRA)

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

Geir Harald Hansen reopened HTTPCORE-289:
-


4.2-beta1 downloaded from the website fails with the attached Test.java code. 
I'm pretty sure this was working with an SVN snapshot at one point.

Do an HTTP request (with telnet, GET, or similar) and kill the process. The 
cancel() method is still not invoked until the timeout.

    
> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Fix For: 4.2-beta1
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: HttpAsyncRequestHandler no longer Cancellable in beta1

2012-02-02 Thread Oleg Kalnichevski
On Thu, 2012-02-02 at 15:26 -0500, William Speirs wrote:
> Anyone know more about why Cancellable was brought in and is now gone?
> I found https://issues.apache.org/jira/browse/HTTPCORE-272 which talks
> about bringing in Cancellable, but nothing about why it went away in
> 4.2-beta1.
> 
> Thanks...
> 
> Bill-
> 

It can be set on HttpAsyncExchange

http://hc.apache.org/httpcomponents-core-dev/httpcore-nio/apidocs/org/apache/http/nio/protocol/HttpAsyncExchange.html#setCallback%28org.apache.http.concurrent.Cancellable%29

Hope this helps

Oleg



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: HttpAsyncRequestHandler no longer Cancellable in beta1

2012-02-02 Thread William Speirs
Anyone know more about why Cancellable was brought in and is now gone?
I found https://issues.apache.org/jira/browse/HTTPCORE-272 which talks
about bringing in Cancellable, but nothing about why it went away in
4.2-beta1.

Thanks...

Bill-

On Mon, Jan 30, 2012 at 10:07 AM, William Speirs  wrote:
> I went to upgrade my code from 4.2-alpha2 to 4.2-beta1 and I noticed
> that HttpAsyncRequestHandler no longer returns a Cancellable object.
> In beta1, how can I receive notifications that this request has been
> cancelled?
>
> Thanks...
>
> Bill-

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Commented] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-17 Thread Geir Harald Hansen (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCORE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188007#comment-13188007
 ] 

Geir Harald Hansen commented on HTTPCORE-289:
-

I re-tested with the latest SVN snapshot. There's now a cancel immediately when 
I kill the connection. Thanks!

Looking forward to the 4.2 release :)

    
> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Fix For: 4.2-alpha3
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Resolved] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-14 Thread Oleg Kalnichevski (Resolved) (JIRA)

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

Oleg Kalnichevski resolved HTTPCORE-289.


Resolution: Fixed

I have found what appears to be a reasonable solution to the problem. Please 
re-test with the latest SVN snapshot.

Oleg

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Fix For: 4.2-alpha3
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Commented] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-14 Thread Oleg Kalnichevski (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCORE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186215#comment-13186215
 ] 

Oleg Kalnichevski commented on HTTPCORE-289:


The problem stems from how HttpAsyncService handles pipelined (out of sequence) 
request messages. Essentially, once a request message has been received the 
protocol handler stops reacting to input events until a response is generated 
and fully written out. So, if you open a connection with telnet and do 
something like that
---
GET / HTTP/1.1

GET / HTTP/1.1


all at once, HttpAsyncService will correctly generate two response messages 
regardless how long it takes to generate each message. The side-effect of this 
approach is that HttpAsyncService cannot detect and react to the opposite end 
causing the connection to go to a half-closed state while waiting for a 
response to get submitted.

Oleg
    
> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Fix For: 4.2-alpha3
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-12 Thread Oleg Kalnichevski (Updated) (JIRA)

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

Oleg Kalnichevski updated HTTPCORE-289:
---

Fix Version/s: 4.2-alpha3

I have a theory why this is happening. Unfortunately if proven correct it may 
mean there is no easy / elegant solution to the problem.

Oleg 

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Fix For: 4.2-alpha3
>
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Commented] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-11 Thread Geir Harald Hansen (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCORE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13184416#comment-13184416
 ] 

Geir Harald Hansen commented on HTTPCORE-289:
-

I tried with the latest version from subversion, but still had no luck. So I 
write a minimal example to show the problem I'm having.

With the attached Test.java I run it, telnet into it and type "GET / HTTP/1.0" 
followed by an empty line. The program now prints "Postponing response..." to 
the console. Now if I kill the telnet process nothing happens. After 30 seconds 
there is a timeout and the program prints "Cancelled!" to the console.

What I expected was to get "Cancelled!" immediately when I kill the telnet 
process, dropping the connection to the program.


> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Updated] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-11 Thread Geir Harald Hansen (Updated) (JIRA)

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

Geir Harald Hansen updated HTTPCORE-289:


Attachment: Test.java

Example to show Cancellable not cancelled when you kill the connection from the 
outside (e.g. on Linux, killing telnet process with kill command)

> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
> Attachments: Test.java
>
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Commented] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-08 Thread Geir Harald Hansen (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCORE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182294#comment-13182294
 ] 

Geir Harald Hansen commented on HTTPCORE-289:
-

IOEventDispatch#disconnected() doesn't get fired when the connection is lost. 
Only if I eventually try to send a response, which fails because the connection 
is long gone.

I will try the latest SVN snapshot and see if I can come up with a minimal 
example.

    
> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Commented] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-08 Thread Oleg Kalnichevski (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCORE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182260#comment-13182260
 ] 

Oleg Kalnichevski commented on HTTPCORE-289:


That sounds bizarre. Are you sure IOEventDispatch#disconnected() never gets 
fired? If it does not, naturally HttpAsyncServiceHandler#closed() never gets 
called as well and the Cancellable cannot be canceled.

By the way, there has been a number of API changes in SVN trunk which will soon 
be released as 4.2-BETA-1. Please consider upgrading to the latest SVN snapshot 
and porting your application to the latest API. As of this point the 4.2 API is 
not expected to change (unless some major design flaws are discovered).

Oleg
    
> Cancellable#cancel() not invoked when network connection dies
> -
>
> Key: HTTPCORE-289
> URL: https://issues.apache.org/jira/browse/HTTPCORE-289
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore NIO
>Affects Versions: 4.2-alpha2
>Reporter: Geir Harald Hansen
>
> I am rewriting my software to use the new API that comes with 4.2-alpha2. 
> Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a 
> good idea for long running requests like long polling. But I don't ever see 
> Cancellable#cancel() being called.
> I telnet into my server and type the necessary HTTP to start a long running 
> request. A Cancellable is created and returned from handle(). Then I kill the 
> telnet process, thereby killing the connection. I expect cancel() to be 
> invoked in the connection's Cancellable at this point, but nothing happens. 
> cancel() is not invoked in my Cancellable, and there are no calls to 
> HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
> DefaultServerIODispatch#onClosed() either.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



[jira] [Created] (HTTPCORE-289) Cancellable#cancel() not invoked when network connection dies

2012-01-08 Thread Geir Harald Hansen (Created) (JIRA)
Cancellable#cancel() not invoked when network connection dies
-

 Key: HTTPCORE-289
 URL: https://issues.apache.org/jira/browse/HTTPCORE-289
 Project: HttpComponents HttpCore
  Issue Type: Bug
  Components: HttpCore NIO
Affects Versions: 4.2-alpha2
Reporter: Geir Harald Hansen


I am rewriting my software to use the new API that comes with 4.2-alpha2. 
Returning a Cancellable from HttpAsyncRequestHandler#handle() seems like a good 
idea for long running requests like long polling. But I don't ever see 
Cancellable#cancel() being called.

I telnet into my server and type the necessary HTTP to start a long running 
request. A Cancellable is created and returned from handle(). Then I kill the 
telnet process, thereby killing the connection. I expect cancel() to be invoked 
in the connection's Cancellable at this point, but nothing happens. cancel() is 
not invoked in my Cancellable, and there are no calls to 
HttpAsyncServiceHandler#closed(), HttpAsyncServiceHandler#exception() or 
DefaultServerIODispatch#onClosed() either.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: Cancellable

2011-09-20 Thread Bill Speirs
OK... that is what I thought, just double-checking.

No better ideas right now, and I think this is a clean design.

Thanks...

Bill-

On Tue, Sep 20, 2011 at 4:13 PM, Oleg Kalnichevski  wrote:
> On Tue, 2011-09-20 at 14:29 -0400, Bill Speirs wrote:
>> I have just started "porting" my code over to the new protocol handler
>> stuff for 4.2-alpha2. I'm confused about what should be returned by
>> the handle() method of a class implementing
>> HttpAsyncRequestHandler.
>
> Hi Bill
>
> Please see HTTPCORE-272 for the rationale of returning Cancellable from
> the #handle method
>
> https://issues.apache.org/jira/browse/HTTPCORE-272
>
> If you can think of a more elegant way of modeling notification for a
> long running process of the underlying connection being closed
> prematurely, please do feel free to propose it.
>
>
>>  All of the examples simply
>> return null.
>
> Which is fine if the process does not want to be notified.
>
>
>>  The JavaDocs documentation has nothing other than the
>> cancel method's signature: boolean cancel(). What is the boolean which
>> is returned by this method?
>
> Returns true if the process has been canceled as a result of the method
> call, false otherwise (the process has completed or been canceled
> previously).
>
> I'll update javadocs before BETA1 or GA release the latest.
>
> cheers
>
> Oleg
>
>
>
> -
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: Cancellable

2011-09-20 Thread Oleg Kalnichevski
On Tue, 2011-09-20 at 14:29 -0400, Bill Speirs wrote:
> I have just started "porting" my code over to the new protocol handler
> stuff for 4.2-alpha2. I'm confused about what should be returned by
> the handle() method of a class implementing
> HttpAsyncRequestHandler.

Hi Bill

Please see HTTPCORE-272 for the rationale of returning Cancellable from
the #handle method 

https://issues.apache.org/jira/browse/HTTPCORE-272

If you can think of a more elegant way of modeling notification for a
long running process of the underlying connection being closed
prematurely, please do feel free to propose it.  


>  All of the examples simply
> return null.

Which is fine if the process does not want to be notified.


>  The JavaDocs documentation has nothing other than the
> cancel method's signature: boolean cancel(). What is the boolean which
> is returned by this method? 

Returns true if the process has been canceled as a result of the method
call, false otherwise (the process has completed or been canceled
previously).

I'll update javadocs before BETA1 or GA release the latest.

cheers

Oleg



-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Cancellable

2011-09-20 Thread Bill Speirs
I have just started "porting" my code over to the new protocol handler
stuff for 4.2-alpha2. I'm confused about what should be returned by
the handle() method of a class implementing
HttpAsyncRequestHandler. All of the examples simply
return null. The JavaDocs documentation has nothing other than the
cancel method's signature: boolean cancel(). What is the boolean which
is returned by this method? True if the operation was canceled and
false otherwise? When would this ever be called?

Thanks...

Bill-

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]