You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Glory Chen (JIRA)" <ji...@apache.org> on 2011/02/21 10:13:39 UTC

[jira] Created: (HTTPCLIENT-1060) Http abort API is not working as expected.

Http abort API is not working as expected.
------------------------------------------

                 Key: HTTPCLIENT-1060
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.0.3
         Environment: Ubuntu, Android platform and Android Phone
            Reporter: Glory Chen


I'm testing a case related to abort a HttpGet request.
When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.

Here's the log for the case.
02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)

The exception was caught 30s after when abort() was called.

I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.

I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?

Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 

Thanks.

-- 
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] Commented: (HTTPCLIENT-1060) Http abort API is not working as expected.

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

Oleg Kalnichevski commented on HTTPCLIENT-1060:
-----------------------------------------------

HttpConnection#close is meant to terminate the connection in an orderly manner by flushing output buffers and gracefully closing out input and output streams. As a consequence #close method is not thread-safe. HttpConnection#shutdown is meant to terminate the connection immediately without making any attempts to transmit data that may still be stored in output buffers. #shutdown is expected to be thread-safe.

Oleg

> Http abort API is not working as expected.
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1060
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0.3
>         Environment: Ubuntu, Android platform and Android Phone
>            Reporter: Glory Chen
>
> I'm testing a case related to abort a HttpGet request.
> When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.
> Here's the log for the case.
> 02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
> 02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
> 02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
> 02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
> 02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
> 02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
> 02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> 02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)
> The exception was caught 30s after when abort() was called.
> I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.
> I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?
> Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 
> Thanks.

-- 
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: (HTTPCLIENT-1060) Http abort API is not working as expected.

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

Oleg Kalnichevski resolved HTTPCLIENT-1060.
-------------------------------------------

    Resolution: Not A Problem

> Http abort API is not working as expected.
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1060
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0.3
>         Environment: Ubuntu, Android platform and Android Phone
>            Reporter: Glory Chen
>
> I'm testing a case related to abort a HttpGet request.
> When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.
> Here's the log for the case.
> 02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
> 02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
> 02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
> 02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
> 02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
> 02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
> 02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> 02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)
> The exception was caught 30s after when abort() was called.
> I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.
> I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?
> Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 
> Thanks.

-- 
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] Commented: (HTTPCLIENT-1060) Http abort API is not working as expected.

Posted by "Glory Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998235#comment-12998235 ] 

Glory Chen commented on HTTPCLIENT-1060:
----------------------------------------

I tested in JSE environment and didn't find the issue. The SocketException will be thrown quickly in the org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer() function. 

Android use org.apache.harmony.luni.net.PlainSocketImpl for plain socket implementation which is different with JSE's implementation. And in this case, java.net.SocketTimeoutException will be thrown after the SO_TIMEOUT milliseconds.

 I'll continue to test in JSE by replacing the PlainSocketImpl with the apache's implementation. 

BTW, I found in SocketHttpClientConnection.close(), it also call sock.shutdownOutput() and sock.shutdownInput() before sock.close. So why in shutdown(), it doesn't call the same apis? 

Thanks for comments.

> Http abort API is not working as expected.
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1060
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0.3
>         Environment: Ubuntu, Android platform and Android Phone
>            Reporter: Glory Chen
>
> I'm testing a case related to abort a HttpGet request.
> When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.
> Here's the log for the case.
> 02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
> 02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
> 02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
> 02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
> 02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
> 02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
> 02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> 02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)
> The exception was caught 30s after when abort() was called.
> I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.
> I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?
> Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 
> Thanks.

-- 
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] Commented: (HTTPCLIENT-1060) Http abort API is not working as expected.

Posted by "Glory Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998754#comment-12998754 ] 

Glory Chen commented on HTTPCLIENT-1060:
----------------------------------------

The issue didn't reproduce in the JSE environment after replace the PlainSocketImpl with the apache harmony library.

After compared the org.apache.harmony.luni native implementation between apache download package and android system, and I found Android Froyo version will have this issue but Android Gingerbread version already fixed this issue. 

Thanks Oleg's comments. 

> Http abort API is not working as expected.
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1060
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0.3
>         Environment: Ubuntu, Android platform and Android Phone
>            Reporter: Glory Chen
>
> I'm testing a case related to abort a HttpGet request.
> When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.
> Here's the log for the case.
> 02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
> 02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
> 02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
> 02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
> 02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
> 02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
> 02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> 02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)
> The exception was caught 30s after when abort() was called.
> I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.
> I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?
> Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 
> Thanks.

-- 
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] Commented: (HTTPCLIENT-1060) Http abort API is not working as expected.

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

Oleg Kalnichevski commented on HTTPCLIENT-1060:
-----------------------------------------------

I see no good reason why a socket must be put into a half closed state before it can be closed with #close method. This sounds more like an issue with Android. Is the problem reproducible with a JSE environment?

Oleg

> Http abort API is not working as expected.
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1060
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1060
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0.3
>         Environment: Ubuntu, Android platform and Android Phone
>            Reporter: Glory Chen
>
> I'm testing a case related to abort a HttpGet request.
> When call HttpGet.abort() method, Http request cannot be aborted immediately in the receiveResponseHeader step.
> Here's the log for the case.
> 02-16 11:21:58.643: INFO/System.out(2601): HttRequestEexecutor doSendRequest() End
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() begin
> 02-16 11:21:58.643: INFO/System.out(2601): HttpRequestExecutor doReceiveResponse() conn.receiveResponseHeader()
> 02-16 11:21:58.643: INFO/System.out(2601): AbstractSessionInputBuffer.fillBuffer() instream.read() begin
> 02-16 11:21:59.010: WARN/TestHttpStack(2601): Abort the http request!
> 02-16 11:21:59.010: INFO/System.out(2601): HttpRequestBase abort() localTrigger.abortconnection()
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown(): Connection shut down
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown()
> 02-16 11:21:59.010: INFO/System.out(2601): SocketHttpClientConnection shutdown() close the socket!
> 02-16 11:21:59.010: INFO/System.out(2601): DefaultClientConnection shutdown() check sock and sock.close()
> 02-16 11:21:59.010: DEBUG/TestHttpStack(2601): Abort Done!
> 02-16 11:22:28.674: INFO/System.out(2601): DefaultRequestDirector execute() catch exception: null
> 02-16 11:22:28.674: WARN/System.err(2601): java.net.SocketTimeoutException
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:104)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:193)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:238)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:289)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
> 02-16 11:22:28.674: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
> 02-16 11:22:28.690: WARN/System.err(2601):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.postRequest(TestHttpStack.java:258)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.sendHttpRequest(TestHttpStack.java:160)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack.access$0(TestHttpStack.java:155)
> 02-16 11:22:28.698: WARN/System.err(2601):     at com.mustardcy.test.httpstack.TestHttpStack$SendHttpRequest.run(TestHttpStack.java:149)
> The exception was caught 30s after when abort() was called.
> I updated the code in DefaultClientConnection.opening(), DefaultClientConnection.shutdown() and SocketHttpClientConnection.shutdown() to call sock.shutdownInput() before sock.close(), and found the exception can be caught immediately after abort() is called.
> I'm not sure whether the fix is correct. So I submitted a issue to get help.  And has the latest HttpClient package fixed this issue?
> Same issue is found in HttpPost.abort() case. My fix is let sock.shutdownOutput() called before sock.close(). 
> Thanks.

-- 
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