You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Tim Julien <tj...@limewire.com> on 2008/02/01 22:45:13 UTC
questions about AbortableHttpRequest.abort()
All,
I have been looking into a stacktrace that has been coming up alot for
our users. This is on core 4.0 alpha 6 and client 4.0 alpha 2 (with
minor URI fixes). The stacktrace is at the bottom of the message.
I haven't been able to reproduce it yet, however, in looking at the
httpcore / client code, I'm having some suspicions about
AbortableHttpRequest.abort(). I might also suspect
IdleConnectionHandler, but the code to add / remove connections to it
seems to look correct.
If you are in middle of doing a client.execute(), and a different Thread
calls abort() (is this even allowed ... ?), the abort will close /
shutdown / null-out a bunch of state that leaves many Objects in an
illegal state. Since these objects are frequently asserted to be open /
non-null, this causes the client.execute() to throw IllegalStateException.
Is any of these statements true:
* Do not call AbortableHttpRequest.abort() from a different Thread than
client.execute
* client.execute() is supposed to throw IllegalStateExceptions when
another Thread calls AbortableHttpRequest.abort() on the request.
* client.execute is supposed to throw IOException OR
InterruptedException when another Thread calls
AbortableHttpRequest.abort() on the request.
Of course, this stacktrace could have nothing to do with
AbortableHttpRequest.abort().
java.lang.IllegalStateException: No wrapped connection.
at
org.apache.http.impl.conn.AbstractClientConnAdapter.assertWrappedConn(AbstractClientConnAdapter.java:119)
at
org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:195)
at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
at
org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:345)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:524)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:476)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:435)
at
com.limegroup.gnutella.http.DefaultHttpExecutor.performRequest(DefaultHttpExecutor.java:97)
at
com.limegroup.gnutella.http.DefaultHttpExecutor.access$000(DefaultHttpExecutor.java:26)
at
com.limegroup.gnutella.http.DefaultHttpExecutor$MultiRequestor.run(DefaultHttpExecutor.java:139)
at
org.limewire.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1006)
at
org.limewire.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:549)
at java.lang.Thread.run(Unknown Source)
-Tim Julien
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: questions about AbortableHttpRequest.abort()
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-02-01 at 16:45 -0500, Tim Julien wrote:
> All,
>
> I have been looking into a stacktrace that has been coming up alot for
> our users. This is on core 4.0 alpha 6 and client 4.0 alpha 2 (with
> minor URI fixes). The stacktrace is at the bottom of the message.
>
> I haven't been able to reproduce it yet, however, in looking at the
> httpcore / client code, I'm having some suspicions about
> AbortableHttpRequest.abort(). I might also suspect
> IdleConnectionHandler, but the code to add / remove connections to it
> seems to look correct.
>
> If you are in middle of doing a client.execute(), and a different Thread
> calls abort() (is this even allowed ... ?), the abort will close /
> shutdown / null-out a bunch of state that leaves many Objects in an
> illegal state. Since these objects are frequently asserted to be open /
> non-null, this causes the client.execute() to throw IllegalStateException.
>
> Is any of these statements true:
> * Do not call AbortableHttpRequest.abort() from a different Thread than
> client.execute
No. AbortableHttpRequest#abort() is primarily meant to be called from a
different thread
> * client.execute() is supposed to throw IllegalStateExceptions when
> another Thread calls AbortableHttpRequest.abort() on the request.
No, it is not, but currently it does. I am working on a fix for the
problem.
> * client.execute is supposed to throw IOException OR
> InterruptedException when another Thread calls
> AbortableHttpRequest.abort() on the request.
>
Yes.
> Of course, this stacktrace could have nothing to do with
> AbortableHttpRequest.abort().
>
>
I reviewed the AbstractClientConnAdapter class I found it prone to all
sorts of concurrency issues. I'll open a JIRA issue for it shortly
Oleg
> java.lang.IllegalStateException: No wrapped connection.
> at
> org.apache.http.impl.conn.AbstractClientConnAdapter.assertWrappedConn(AbstractClientConnAdapter.java:119)
> at
> org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:195)
> at
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
> at
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
> at
> org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:345)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:524)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:476)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:435)
> at
> com.limegroup.gnutella.http.DefaultHttpExecutor.performRequest(DefaultHttpExecutor.java:97)
> at
> com.limegroup.gnutella.http.DefaultHttpExecutor.access$000(DefaultHttpExecutor.java:26)
> at
> com.limegroup.gnutella.http.DefaultHttpExecutor$MultiRequestor.run(DefaultHttpExecutor.java:139)
> at
> org.limewire.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1006)
> at
> org.limewire.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:549)
> at java.lang.Thread.run(Unknown Source)
>
> -Tim Julien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org