title: Java library AmazonS3Client.getObject never returns
body: <p>I'm experiencing an issue in which it would appear that calls to <code>AmazonS3Client.getObject</code> never returns; this is happening to us every day, and I believe it's when S3 is running it's daily expiry job.</p>
  
  <p>There doesn't seem to be a way to specify a timeout value for this request, and it's causing our thread pool to become blocked indefinitely, making our entire instance unresponsive when enough of them hang indefinitely.</p>
  
  <p>Is there a way to overcome? I've gone down the <code>Thread.interrupt</code> path, but am not sure if it will that signal will abided.</p>
  
  <p>Here is the stack trace for where it is getting stuck:</p>
  
  <pre><code>"image-s3-dispatcher-10187" - Thread t@10481
     java.lang.Thread.State: TIMED_WAITING
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for &lt;7945c7e6&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:267)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitUntil(AbstractQueuedSynchronizer.java:2130)
    at org.apache.http.pool.PoolEntryFuture.await(PoolEntryFuture.java:129)
    at org.apache.http.pool.AbstractConnPool.getPoolEntryBlocking(AbstractConnPool.java:281)
    at org.apache.http.pool.AbstractConnPool.access$000(AbstractConnPool.java:62)
    at org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:176)
    at org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:172)
    at org.apache.http.pool.PoolEntryFuture.get(PoolEntryFuture.java:100)
    at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:212)
    at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:199)
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.amazonaws.http.conn.ClientConnectionRequestFactory$Handler.invoke(ClientConnectionRequestFactory.java:70)
    at com.amazonaws.http.conn.$Proxy9.getConnection(Unknown Source)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:456)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:384)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:232)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3528)
    at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1111)
    at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:984)
    at com.spingo.s3client.S3Client$$anonfun$read$1.apply(S3Client.scala:110)
  </code></pre>
  
  <p>All of the 8 pending requests on which it is stuck are for files &lt;=10kb, some of the requests are as old as 15 minutes.</p>