hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HTTPCLIENT-1572) Aborting request execution doesn't throw RequestAbortedException
Date Fri, 17 Oct 2014 18:59:34 GMT

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

Oleg Kalnichevski edited comment on HTTPCLIENT-1572 at 10/17/14 6:59 PM:
-------------------------------------------------------------------------

Filip

The main purpose of the #abort method is to ensure the #execute method does not get blocked
in an I/O operation and terminates as soon as possible. RequestAbortedException is thrown
only to interrupt the normal execution flow. If the #execute is not going to get blocked in
an I/O operation (for instance if a response head has already been received) there is no need
to throw RequestAbortedException. This is precisely the case with your test application.

{noformat}
[DEBUG] wire - http-outgoing-0 >> "GET /test HTTP/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Host: localhost:8000[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.3.5 (java 1.5)[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Date: Fri, 17 Oct 2014 18:26:18 GMT[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Content-length: 42[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "[\r][\n]"
Caught: java.lang.RuntimeException: NOT OK
java.lang.RuntimeException: NOT OK
{noformat}

Oleg


was (Author: olegk):
{noformat}
[DEBUG] wire - http-outgoing-0 >> "GET /test HTTP/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Host: localhost:8000[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.3.5 (java 1.5)[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Date: Fri, 17 Oct 2014 18:26:18 GMT[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Content-length: 42[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "[\r][\n]"
Caught: java.lang.RuntimeException: NOT OK
java.lang.RuntimeException: NOT OK
{noformat}

> Aborting request execution doesn't throw RequestAbortedException
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1572
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1572
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 4.3.3
>         Environment: gradle dependencies: 
> compile 'org.apache.httpcomponents:httpclient:4.3.3'
> compile 'org.codehaus.groovy:groovy-all:2.3.6'
> $ java -version
> java version "1.7.0_51"
> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
> $ uname -a
> Linux phill-kubuntu-pc 3.13.0-38-generic #65-Ubuntu SMP Thu Oct 9 11:36:50 UTC 2014 x86_64
x86_64 x86_64 GNU/Linux
>            Reporter: Filip Malczak
>            Priority: Minor
>         Attachments: MyHandler.groovy, Test.groovy
>
>
> I'm trying to create some fluent API for HttpClient for Groovy. While implementing hard
timeout for requests in this API, I found out that HttpRequestBase.abort() doesn't always
throw RequestAbortedException.
> This may be my misunderstanding of HC API, or bug.
> I attach two files used to specific situation when this occurs. Client, request configs,
etc are constructed so explicitly to mirror structure and logic of my wrapper.
> I know that implementation of mock server with com.sun.net packages is wrong, but this
is example case.
> I wasn't sure what component to attach this issue to, if you do, fix this, please.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message