hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Boniface <tho...@stickyads.tv>
Subject Re: Cancel and socket state
Date Wed, 29 Jan 2014 16:38:13 GMT
Thanks for your help regarding the snapshot. Here is an updated log using
the 4.0.1-SNAPSHOT.

Regarding request cancel, it is done as follow:

if (futureHttpResponse != null && !futureHttpResponse.isCancelled()) {
            futureHttpResponse.cancel(true);
}

where futureHttpResponse  what the object return by the execute call.

Thomas



2014-01-29 Oleg Kalnichevski <olegk@apache.org>

> On Wed, 2014-01-29 at 16:36 +0100, Thomas Boniface wrote:
> > I can't get my hand on the snapshot can you give a pointer ?
> >
> > It doesn't appear to be available at:
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/httpcomponents/
> >
> > Nor I can download it using maven: mvn
> > org.apache.maven.plugins:maven-dependency-plugin:2.4:get
> > -DartifactId=httpcomponents-asyncclient
> -DgroupId=org.apache.httpcomponents
> > -Dversion=4.0.1-SNAPSHOT
> >
> > Thanks
> >
>
> Thomas
>
> It is generally preferred to build snapshots from source [1][2]. That
> way one can be sure to get the latest.
>
> If that makes your life easier though I just deployed the latest
> snapshot to the ASF snapshot repository [3]
>
> Oleg
>
> [1]
> http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/
> [2] https://github.com/apache/httpasyncclient
> [3]
>
> https://repository.apache.org/content/repositories/snapshots/org/apache/httpcomponents/httpasyncclient/4.0.1-SNAPSHOT/
>
> >
> >
> > 2014-01-29 Oleg Kalnichevski <olegk@apache.org>
> >
> > > On Wed, 2014-01-29 at 14:21 +0100, Thomas Boniface wrote:
> > > > Hi Oleg,
> > > >
> > > > Here is a log with the wire and context log for the behavior I
> described
> > > > before. I obfuscated  business related details in the log but most
> of the
> > > > interesting things should be there.
> > > >
> > > > Thanks,
> > > > Thomas
> > > >
> > > >
> > >
> > > For some reason the client considers the connection to be an
> > > inconsistent state and drops it. I cannot figure out why just by
> looking
> > > at the log.
> > >
> > > Could you please do the following: upgrade to the latest
> 4.0.1-SNAPSHOT,
> > > re-run the test and re-post the log as well as let me know exactly how
> > > your application cancels the request?
> > >
> > > Oleg
> > >
> > > >
> > > > 2014-01-29 Oleg Kalnichevski <olegk@apache.org>
> > > >
> > > > > On Wed, 2014-01-29 at 10:42 +0100, Thomas Boniface wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I am using the httpasyncclient 4.0.
> > > > > >
> > > > > > Thomas
> > > > > >
> > > > >
> > > > > Then, things do not quite add up. If one cancels the result future,
> > > this
> > > > > should have no impact on the ongoing request execution. The request
> > > > > still gets fully executed, the response gets fully processed and
> the
> > > > > underlying connection gets returned back to the pool (provided it
> can
> > > be
> > > > > kept alive). The future is simply considered done and will receive
> no
> > > > > result notification.
> > > > >
> > > > > Please note though that connections cannot be kept alive in some
> cases.
> > > > > So, it is perfectly normal that the socket may end up in the
> TIME_WAIT
> > > > > state after the response has been fully processed.
> > > > >
> > > > > Wire / context log should help find out why the connection needs
> to be
> > > > > closed.
> > > > >
> > > > > http://hc.apache.org/httpcomponents-client-4.3.x/logging.html
> > > > >
> > > > > Oleg
> > > > >
> > > > > >
> > > > > > 2014-01-29 Oleg Kalnichevski <olegk@apache.org>
> > > > > >
> > > > > > > On Tue, 2014-01-28 at 18:00 +0100, Thomas Boniface wrote:
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > I am using an http async client to contact several
endpoints
> in
> > > a row
> > > > > > > with
> > > > > > > > the same process. In the context of my application
I want to
> > > keep the
> > > > > > > > global process under a certain time. Sometimes it
happens
> some
> > > of the
> > > > > > > > executes I triggered using the client did not respond
before
> > > what I
> > > > > > > > consider to be a reasonable time.
> > > > > > > >
> > > > > > > > In such a case I used to call cancel on the Future
object
> > > returned
> > > > > by the
> > > > > > > > execute in order to free the socket used by this execute
as
> soon
> > > as
> > > > > > > > possible (as I don't need the response anymore). The
thing
> is it
> > > > > appears
> > > > > > > > that the socket is closed instead of being put back
in the
> pool
> > > when
> > > > > I
> > > > > > > call
> > > > > > > > the cancel (The socket appears in TIME_WAIT state
when I use
> > > netstat
> > > > > > > > whereas when there is no timeout the socket appears
as
> > > ESTABLISHED).
> > > > > > > >
> > > > > > > > Is this an expected behavior ?
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Thomas
> > > > > > >
> > > > > > > Thomas,
> > > > > > >
> > > > > > > What version of HttpAsyncClient are you using?
> > > > > > >
> > > > > > > Oleg
> > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> httpclient-users-unsubscribe@hc.apache.org
> > > > > > > For additional commands, e-mail:
> > > httpclient-users-help@hc.apache.org
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > > For additional commands, e-mail:
> httpclient-users-help@hc.apache.org
> > > > >
> > > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> > >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
View raw message