hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: IllegalStateException when sending a new request with a HttpClient that allready sent an aborted request.
Date Mon, 21 Apr 2008 19:11:49 GMT

On Sat, 2008-04-19 at 12:28 +0200, Jan Bracker wrote:
> Here the attached java source reproduces the error :)
> I hope you can fix it.
> 
> Regards,
> Jan Bracker
> 

Hi Jan,

It turned out to be quite a nasty problem.

https://issues.apache.org/jira/browse/HTTPCLIENT-763

Fixed in SVN trunk. Please re-test your application against the latest
SVN snapshot.

Oleg


> 2008/4/19, Oleg Kalnichevski <olegk@apache.org>:
> >
> >  On Fri, 2008-04-18 at 22:32 +0200, Jan Bracker wrote:
> >  > Well, atleast the error doesn't seem have malicious side effects.
> >  > Everything seems to work alltough the error occures and subsequent
> >  > requests (when the previous one was not aborted) don't give the error
> >  > message anymore.
> >  >
> >
> >
> > Jan,
> >
> >  I'll try to look into the problem in the coming days. It would really
> >  help, though, if you could put together a test case that reproduces the
> >  problem.
> >
> >
> >  Oleg
> >
> >
> >
> >  > 2008/4/18, Sam Berlin <sberlin@gmail.com>:
> >  > > I guess that wasn't the problem then. :(
> >  > >
> >  > >
> >  > >  Sam
> >  > >
> >  > >  On 4/18/08, Jan Bracker <jan.bracker@googlemail.com> wrote:
> >  > >  > I just tryed the linked version. When i try to execute a request
with
> >  > >  > the HttpClient i previously aborted a request from the same exceptions
> >  > >  > occures as warning:
> >  > >  >
> >  > >  > 47492 [Thread-5] WARN
> >  > >  > org.apache.http.impl.conn.SingleClientConnManager  - Invalid use
of
> >  > >  > SingleClientConnManager: connection still allocated.
> >  > >  > Make sure to release the connection before allocating another one.
> >  > >  > java.lang.IllegalStateException: Revoking connection to
> >  > >  > HttpRoute[{}->http://www.dfr-software.de:80]
> >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.revokeConnection(SingleClientConnManager.java:339)
> >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:215)
> >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager$1.getConnection(SingleClientConnManager.java:186)
> >  > >  >        at org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:294)
> >  > >  >        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:501)
> >  > >  >        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:464)
> >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.requestFileInfo(HttpDownload.java:297)
> >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.initializeDownloader(HttpDownload.java:428)
> >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.run(HttpDownload.java:543)
> >  > >  >        at java.lang.Thread.run(Thread.java:619)
> >  > >  >
> >  > >  > It seems the exception still occures...
> >  > >  >
> >  > >  > 2008/4/18, Sam Berlin <sberlin@gmail.com>:
> >  > >  > > Ya, 4.0.  There's some snapshots available @ people.apache.org,
the
> >  > >  > >  latest of which appears to be:
> >  > >  > >  http://people.apache.org/repo/m2-snapshot-repository/org/apache/httpcomponents/httpclient/4.0-alpha4-SNAPSHOT/httpclient-4.0-alpha4-20080417.184048-7.jar
> >  > >  > >  .  I can't guarantee they'll work (as the API is in flux),
but if your
> >  > >  > >  code can compile against it and run, and the error goes away,
atleast
> >  > >  > >  we can verify that the bug is indeed fixed for the next alpha
release.
> >  > >  > >
> >  > >  > >
> >  > >  > >  Sam
> >  > >  > >
> >  > >  > >  On 4/18/08, Jan Bracker <jan.bracker@googlemail.com>
wrote:
> >  > >  > >  > Sorry, i don't have any experience with building maven
projects...
> >  > >  > >  >
> >  > >  > >  > I forget to say that i'm working with 4.0, not that
we missunderstand :)
> >  > >  > >  >
> >  > >  > >  > 2008/4/18, Sam Berlin <sberlin@gmail.com>:
> >  > >  > >  > > This is likely due to a problem with the last alpha
release of
> >  > >  > >  > >  HttpClient.  Aborted connections weren't properly
released back to
> >  > >  > >  > >  connection managers.  It's been fixed, but I'm
not sure a new release
> >  > >  > >  > >  was issued.
> >  > >  > >  > >
> >  > >  > >  > >  Is it possible to try building httpclient from
source and see if the
> >  > >  > >  > >  problem still occurs?
> >  > >  > >  > >
> >  > >  > >  > >  Sam
> >  > >  > >  > >
> >  > >  > >  > >
> >  > >  > >  > >  On 4/18/08, Jan Bracker <jan.bracker@googlemail.com>
wrote:
> >  > >  > >  > >  > Hello,
> >  > >  > >  > >  >
> >  > >  > >  > >  > when i abort a request and after that, start
a new one with my
> >  > >  > >  > >  > DefaultHttpClient i get the following exception:
> >  > >  > >  > >  > 29207 [Thread-3] WARN
> >  > >  > >  > >  > org.apache.http.impl.conn.SingleClientConnManager
 - Invalid use of
> >  > >  > >  > >  > SingleClientConnManager: connection still
allocated.
> >  > >  > >  > >  > Make sure to release the connection before
allocating another one.
> >  > >  > >  > >  > java.lang.IllegalStateException: Revoking
connection to
> >  > >  > >  > >  > HttpRoute[{}->http://selfhtml.mijabo.de:80]
> >  > >  > >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.revokeConnection(SingleClientConnManager.java:345)
> >  > >  > >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:220)
> >  > >  > >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:195)
> >  > >  > >  > >  >        at org.apache.http.impl.client.DefaultClientRequestDirector.allocateConnection(DefaultClientRequestDirector.java:508)
> >  > >  > >  > >  >        at org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:293)
> >  > >  > >  > >  >        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:500)
> >  > >  > >  > >  >        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:463)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.requestFileInfo(HttpDownload.java:294)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.initializeDownloader(HttpDownload.java:423)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.run(HttpDownload.java:536)
> >  > >  > >  > >  >        at java.lang.Thread.run(Thread.java:619)
> >  > >  > >  > >  >
> >  > >  > >  > >  > Allthough it is only a warning I followed
the given adivce and tried
> >  > >  > >  > >  > the following after i abort a request:
> >  > >  > >  > >  > this.REQUEST.abort();
> >  > >  > >  > >  > try {
> >  > >  > >  > >  >    this.CLIENT.getConnectionManager().releaseConnection(
> >  > >  > >  > >  >            this.CLIENT.getConnectionManager().getConnection(new
> >  > >  > >  > >  > HttpRoute(HttpDownload.this.HOST)));
> >  > >  > >  > >  > }
> >  > >  > >  > >  > catch(InterruptedException e) {
> >  > >  > >  > >  >    LOG.warn("Releasing the connection failed
for download: "
> >  > >  > >  > >  >            + HttpDownload.this.getSource().toString(),
e);
> >  > >  > >  > >  > }
> >  > >  > >  > >  >
> >  > >  > >  > >  > After that the warning did not appear anymore
after starting a new
> >  > >  > >  > >  > request, but for some reason this exception
appeared as warning when
> >  > >  > >  > >  > aborting/trying to release the connection:
> >  > >  > >  > >  > 40827 [Thread-3] WARN
> >  > >  > >  > >  > org.apache.http.impl.conn.SingleClientConnManager
 - Invalid use of
> >  > >  > >  > >  > SingleClientConnManager: connection still
allocated.
> >  > >  > >  > >  > Make sure to release the connection before
allocating another one.
> >  > >  > >  > >  > java.lang.IllegalStateException: Revoking
connection to
> >  > >  > >  > >  > HttpRoute[{}->http://selfhtml.tobias-unger.com:80]
> >  > >  > >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.revokeConnection(SingleClientConnManager.java:345)
> >  > >  > >  > >  >        at org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:220)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.releaseConnection(HttpDownload.java:410)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.finalizeDownloader(HttpDownload.java:527)
> >  > >  > >  > >  >        at org.downman.download.http.HttpDownload$HttpDownloader.run(HttpDownload.java:601)
> >  > >  > >  > >  >        at java.lang.Thread.run(Thread.java:619)
> >  > >  > >  > >  >
> >  > >  > >  > >  > It seems to be the same error. I wanted to
ask, what am i doing wrong?
> >  > >  > >  > >  > Is it normal to recieve a warning exception
when sending requests
> >  > >  > >  > >  > after previously aborting one? How can i
get rid of this warning?
> >  > >  > >  > >  >
> >  > >  > >  > >  > As a sidenote: I am reusing one and the same
HttpRequest (same
> >  > >  > >  > >  > instance) and HttpClient multiple times.
> >  > >  > >  > >  >
> >  > >  > >  > >  > Regards,
> >  > >  > >  > >  > Jan Bracker
> >  > >  > >  > >  >
> >  > >  > >  > >
> >  > >  > >  > > > ---------------------------------------------------------------------
> >  > >  > >  > >  > 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
> >  > >  > >
> >  > >  > >
> >  > >  >
> >  > >  > ---------------------------------------------------------------------
> >  > >  > 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
> >
> >
> ---------------------------------------------------------------------
> 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