Hi Cory, I don't think your debug log necessarily relates to the exception... Your stacktrace indicates that the error was thrown for an SSL connection, but your log indicates you were sending plain HTTP requests.
Anyway, servers will commonly allow connections to be kept alive, but only for a short time. After that time they will close the connections, and the client (HttpClient here) may not be notified that the connection was closed (or it may be left in a half-open state). For this reason, you may want to have a background thread that is forcibly closing connections that have been idle longer than X seconds. It's a common problem - check out the example at http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java Thanks, Sam On 27 March 2012 21:24, Cory Lum <[email protected]> wrote: > Hi guys, > > > > I'm using ThreadSafeClientConnManager from HttpComponents library for > multithreaded post requests and I'm running into the following exception. > > java.io.InterruptedIOException: Connection has been shut down > > at > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:543) > > at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) > > at some.package.SomeClass.execute(SomeClass.java:123) > > Caused by: org.apache.http.impl.conn.ConnectionShutdownException > > at > org.apache.http.impl.conn.AbstractClientConnAdapter.assertValid(AbstractClientConnAdapter.java:154) > > at > org.apache.http.impl.conn.AbstractClientConnAdapter.getSSLSession(AbstractClientConnAdapter.java:270) > > at > org.apache.http.impl.client.DefaultUserTokenHandler.getUserToken(DefaultUserTokenHandler.java:80) > > at > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:516) > > > > Here's the DEBUG output before the exception which looks fine. > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] > [HttpRoute[{}->http://localhost:8080]] total kept alive: 2, total issued: 0, > total allocated: 2 out of 20 > > [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Get > connection: HttpRoute[{}->http://localhost:8080], timeout = 0 > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Getting free > connection [HttpRoute[{}->http://localhost:8080]][null] > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] > [HttpRoute[{}->http://localhost:8080]] total kept alive: 1, total issued: 1, > total allocated: 2 out of 20 > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Getting free > connection [HttpRoute[{}->http://localhost:8080]][null] > > [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Released > connection is reusable. > > [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Released > connection is not reusable. > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Releasing connection > [HttpRoute[{}->http://localhost:8080]][null] > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Pooling connection > [HttpRoute[{}->http://localhost:8080]][null]; keep alive indefinitely > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Releasing connection > [HttpRoute[{}->http://localhost:8080]][null] > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Notifying no-one, > there are no waiting threads > > [org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Notifying no-one, > there are no waiting threads > > > > Any ideas what might be the problem? Looking at the source > code(DefaultRequestDirector.java), if a connection is not reusable, why does > it still try to get the user token to set into connection? > > > > Thanks, > > Cory --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
