[
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: [email protected]
For additional commands, e-mail: [email protected]