saroja nidadavolu created HTTPASYNC-151:
-------------------------------------------
Summary: MainClientExec.prepare() throws
java.lang.IndexOutOfBoundsException: Index: 0, Size: -1
Key: HTTPASYNC-151
URL: https://issues.apache.org/jira/browse/HTTPASYNC-151
Project: HttpComponents HttpAsyncClient
Issue Type: Bug
Affects Versions: 4.1.4
Reporter: saroja nidadavolu
Fix For: 4.1.5
There is a server which connects to third party server to fetch valid HTTP
response.
Configured a thread pool of size 2 and trying to get the response through
future get and then facing IndexOutOfBoundsException: Index: 0, Size: -1. Issue
is seen *intermittently*.
{code:java}
// My lines of code where issue is seen
public Object processRequest() throws Exception {
..
..
Future<HttpResponse> future = httpclient.execute(httpReq, context, null);
httpResponse = future.get();
..
..
}{code}
As a java developer, I have never seen IIndexOutOfBoundsException with size of
-1, so only thing I can guess is that the List is not being used in thread safe
manner(redirectLocations in MainClientExec.java), corrupting the list.
Stack trace:
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException:
Index: 0, Size: -1
at org.apache.http.concurrent.BasicFuture.getResult(BasicFuture.java:70)
at org.apache.http.concurrent.BasicFuture.get(BasicFuture.java:80)
at
com.bwinparty.apicontainer.outbound.rest.httpasync.HttpAsyncClientProcessor.processRequest(HttpAsyncClientProcessor.java:272)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: -1
at java.util.AbstractList.rangeCheckForAdd(AbstractList.java:605)
at java.util.AbstractList.listIterator(AbstractList.java:325)
at java.util.AbstractList.removeRange(AbstractList.java:568)
at java.util.AbstractList.clear(AbstractList.java:234)
at
org.apache.http.impl.nio.client.MainClientExec.prepare(MainClientExec.java:135)
at
org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:124)
at
org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:141)
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:74)
at
org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:107)
at
com.bwinparty.apicontainer.outbound.rest.httpasync.HttpAsyncClientProcessor.processRequest(HttpAsyncClientProcessor.java:271)
... 15 more
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]