RestClient java.lang.RuntimeException: error while performing request

Hi, Thank you for the great open source!

I am using RestClient(java) to connect elastic cloud for searching.

The program is multi thread environment and each thread can call restclient.

This is error :

java.lang.RuntimeException: error while performing request
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:681)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:219)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:191)
at com.dispatch.workflow.CalcDiffThread.getNearNodes(CalcDiffThread.java:294)
at com.dispatch.workflow.CalcDiffThread.calcList(CalcDiffThread.java:106)
at com.dispatch.workflow.CalcDiffThread.calcDiff(CalcDiffThread.java:87)
at com.dispatch.workflow.CalcDiffThread.call(CalcDiffThread.java:54)
at com.dispatch.workflow.CalcDiffThread.call(CalcDiffThread.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.TimeoutException
at org.apache.http.nio.pool.AbstractNIOConnPool.processPendingRequest(AbstractNIOConnPool.java:364)
at org.apache.http.nio.pool.AbstractNIOConnPool.processNextPendingRequest(AbstractNIOConnPool.java:344)
at org.apache.http.nio.pool.AbstractNIOConnPool.release(AbstractNIOConnPool.java:318)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.releaseConnection(PoolingNHttpClientConnectionManager.java:303)
at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.releaseConnection(AbstractClientExchangeHandler.java:239)
at org.apache.http.impl.nio.client.MainClientExec.responseCompleted(MainClientExec.java:387)
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:168)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
... 1 more


<dependencies>
	<dependency>
		<groupId>com.googlecode.json-simple</groupId>
		<artifactId>json-simple</artifactId>
		<version>1.1.1</version>
	</dependency>
	<dependency>
		<groupId>org.elasticsearch.client</groupId>
		<artifactId>rest</artifactId>
		<version>5.3.0</version>
	</dependency>
	<dependency>
		<groupId>org.apache.logging.log4j</groupId>
		<artifactId>log4j-to-slf4j</artifactId>
		<version>2.6</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-api</artifactId>
		<version>1.7.21</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-simple</artifactId>
		<version>1.7.21</version>
	</dependency>
	<dependency>
		<groupId>org.apache.mina</groupId>
		<artifactId>mina-core</artifactId>
		<version>2.0.16</version>
	</dependency>
	<dependency>
		<groupId>org.elasticsearch.client</groupId>
		<artifactId>x-pack-transport</artifactId>
		<version>5.3.0</version>
	</dependency>
	<dependency>
		<groupId>org.locationtech.spatial4j</groupId>
		<artifactId>spatial4j</artifactId>
		<version>0.6</version>
	</dependency>


	<dependency>
		<groupId>biz.paluch.redis</groupId>
		<artifactId>lettuce</artifactId>
		<version>4.3.0.Final</version>
	</dependency>
	<dependency>
		<groupId>com.amazonaws</groupId>
		<artifactId>amazon-sqs-java-messaging-lib</artifactId>
		<version>1.0.1</version>
		<type>jar</type>
	</dependency>
</dependencies>

If you have any advice on it, please let me know!

Thanks,
HJ Shin

Hi,
looking at your stacktrace it seems like you have a TimeoutException, which would indicate a timeout when trying to obtain a connection from the connection pool. Do you have that consistently or did it only happen one time?

Cheers
Luca

1 Like

Thanks for the replying Luca!

I think same as you.

I guess that this problem happens when threads are huge.

Do you have any idea to calculate right amount of queries based on node spec?

I am currently using elastic cloud.

1 node
Memory 8 GB
Storage 192 GB
SSD Yes
High availability No

I don't have enough context to conclude whether this has to do with number of threads and what they do, or just connectivity issues, or? As I asked before, did you have this problem only once in your logs or multiple times? Can you reproduce it and pinpoint it to a load issue?

1 Like

My system has pattern for usage.

Users are sending their request a lot at sudden time.

Above error happened at this moment so I assume that this problem comes from heavy threads.

I reduced the number of thread pool size and the problem gone.

Thanks for the reply!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.