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 (Created) (JIRA)" <ji...@apache.org> on 2012/01/21 14:55:48 UTC

[jira] [Created] (HTTPCORE-291) Out-of-order responses to pipelined requests

Out-of-order responses to pipelined requests
--------------------------------------------

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


I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.

I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.

Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.

I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.


--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-291) Out-of-order responses to pipelined requests

Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192528#comment-13192528 ] 

Oleg Kalnichevski commented on HTTPCORE-291:
--------------------------------------------

All right. I also do not want to delay the release unnecessarily as it blocks releases of HttpClient and HttpAsyncClient. I'll see if full support for pipelined request could be added in the course of BETA2 development.

Feel free to re-test your application against the release candidate and let me know immediately if anything does not work as intended.
 
https://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.2-beta1-RC2/ 

Oleg
                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCORE-291) Out-of-order responses to pipelined requests

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

Oleg Kalnichevski resolved HTTPCORE-291.
----------------------------------------

    Resolution: Fixed

I fixed the most immediate problem, which is out of sequence responses to pipelined requests. 

http://svn.apache.org/viewvc?view=revision&revision=1234543

I also started to put together a suite of test case that defines the expected behavior with regards to handling of pipelined requests

http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestPipelining.java?view=markup&pathrev=1234543

Please feel free to add more test cases defining your expectations of correct handling of pipelined requests.

I am also in the process of evaluating of the possibility of improving request pipelining handling in HttpAsyncService and making it work correctly together with Cancellable callback. One thing I am not sure about is whether it should warrant a delay of 4.2 BETA1 release or it could wait until 4.2 BETA2. Please let me know your preference.

Oleg
                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-291) Out-of-order responses to pipelined requests

Posted by "Geir Harald Hansen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13200276#comment-13200276 ] 

Geir Harald Hansen commented on HTTPCORE-291:
---------------------------------------------

4.2-beta1-RC2 doesn't react when I terminate a connection (Cancellable is not cancelled). It worked fine in the alpha3 snapshot.

Also, when using alpha3, I had problems with deadlocks. When Cancellable#cancel() is invoked I would wait on another thread that was responsible for the cancellables while it was calling HttpAsyncExchange#submitResponse(). This caused a deadlock - I assume those two threads were waiting for each other. I think this is likely to be a problem for others as well. I "solved" it by having the thread that handles cancellables remove it asynchronously, while cancel() returns always true. Haven't checked yet  what bad effects always returning true from cancel() might have.

                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>             Fix For: 4.2-beta1
>
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-291) Out-of-order responses to pipelined requests

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

Geir Harald Hansen updated HTTPCORE-291:
----------------------------------------

    Attachment: testrun.txt
                Test.java

Attached files that show the issue
                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-291) Out-of-order responses to pipelined requests

Posted by "Geir Harald Hansen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191498#comment-13191498 ] 

Geir Harald Hansen commented on HTTPCORE-291:
---------------------------------------------

I just tried SVN revision 1234972. It looks like postponed requests are now always cancelled if the connection is closed. The issue with pipelining is avoided by detecting the situation and responding with an error before closing the connection.

About the problem with postponed POST requests with body data, I have to apologize, there is no bug. I was not aware that my telnet client was sending both linefeed and carriage return when I hit enter. Adding 1 to the content-length in the testrun.txt example makes it run just fine.

That just leaves support for pipelining of long polling requests.

I'm not sure how I'd expect it to behave. If a first request has its response delayed, should processing of a second request continue immediately and that second response be queued until the first response is sent? It could have a performance benefit. But also, it could mean the data in the second response is out of date and useless by the time it is sent. The connection could also get closed before the response can be sent which would mean that producing it was a waste of resources. I think my vote would be on halting all processing on the socket until either the delayed response is ready or the connection is closed.

I hope browsers don't do pipelining of AJAX requests.

I don't have any preference for BETA1 or BETA2, personally. HttpComponents now does everything I need in my current projects in the current SVN revision. The next thing I would want is a stable release with all the new features and bugfixes in it. So do BETA1 and BETA2 as you prefer, I'll test them along the way.
                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-291) Out-of-order responses to pipelined requests

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

Oleg Kalnichevski updated HTTPCORE-291:
---------------------------------------

    Fix Version/s: 4.2-beta1
    
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>             Fix For: 4.2-beta1
>
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-291) Out-of-order responses to pipelined requests

Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13210457#comment-13210457 ] 

Oleg Kalnichevski commented on HTTPCORE-291:
--------------------------------------------

Please raise separate issues for both problems. Please also provide a thread dump showing the deadlock.

Oleg
                
> Out-of-order responses to pipelined requests
> --------------------------------------------
>
>                 Key: HTTPCORE-291
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-291
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Geir Harald Hansen
>             Fix For: 4.2-beta1
>
>         Attachments: Test.java, testrun.txt
>
>
> I am having a problem with the latest HttpCore NIO from the Subversion repository (revision 1234228). I have not tested this on earlier versions.
> I am observing two problems, but they stem from the same underlying issue - that after a response is delayed, processing of subsequent pipelined requests on the same socket continues immediately.
> Problem 1: If the response to your first request is delayed, but not the second, they are delivered out of order.
> Problem 2: If a request has a body (entity) then right after processing that request and delaying its response, there is a response on the wire ("400 Bad Request") and the connection is terminated. When this happens none of the delayed responses are cancelled, that is Cancellable#cancel() is never called.
> I will attach example source code, and an example of running telnet against the program, to show what is happening. There is first a request that is delayed and never gets a response. The second request gets a response immediately, out of order. The third request (a POST with body) also has its response delayed. But then there is a 400 bad request response and the connection is severed. The two delayed responses are not cancelled.

--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org