Error - RestClient java.lang.RuntimeException: error while performing request

We are getting this error regularly in our production environment.
We are building the RestClient using default configurations.

public RestClient build() {
            if (this.failureListener == null) {
                this.failureListener = new FailureListener();
            }
            CloseableHttpAsyncClient httpClient = this.createHttpClient();
            RestClient restClient = new RestClient(httpClient, (long)this.maxRetryTimeout, this.defaultHeaders, this.hosts, this.pathPrefix, this.failureListener);
            httpClient.start();
            return restClient;
        }

Stacktrace:

com.repository.exception.RepositoryServicesException: java.lang.RuntimeException: error while performing request

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.23.RELEASE.jar!/:4.3.23.RELEASE]

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at com.enterpriseimaging.documentapi.service.RouteService.route(RouteService.java:104) ~[classes!/:0.0.739]

at com.enterpriseimaging.documentapi.config.DocumentRouterAspect.around(DocumentRouterAspect.java:37) ~[classes!/:0.0.739]

at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]

at com...enterpriseimaging.documentapi.service.impl.DocumentSearchServiceImpl$$EnhancerBySpringCGLIB$$83151592.searchDocument(<generated>) ~[classes!/:0.0.739]

at com...enterpriseimaging.documentapi.rest.v3.DocumentResource.lambda$asyncGetList$2(DocumentResource.java:166) ~[classes!/:0.0.739]

at com.....engine.core.concurrent.FunctionRequestContextHandlerBaseImpl.copyScope(FunctionRequestContextHandlerBaseImpl.java:50) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at com.....engine.core.concurrent.FunctionRequestContextHandlerBaseImpl.copyScope(FunctionRequestContextHandlerBaseImpl.java:64) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at com.....engine.core.concurrent.RequestContextAwareCallable.call(RequestContextAwareCallable.java:57) [.-core-concurrency-2.8.3.RELEASE.jar!/:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_191]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

Caused by: java.lang.RuntimeException: error while performing request

at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:681) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestClient.performRequest(RestClient.java:219) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestClient.performRequest(RestClient.java:191) ~[elasticsearch-rest-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:396) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:382) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:323) ~[elasticsearch-rest-high-level-client-5.6.4.jar!/:5.6.4]

at com...enterpriseimaging.repository.dao.impl.RepositoryDAOImpl.executeRestSearchQuery(RepositoryDAOImpl.java:268) ~[ei-repository-library-0.0.68.jar!/:?]

at com...enterpriseimaging.repository.dao.impl.RepositoryDAOImpl.lambda$searchRepository$0(RepositoryDAOImpl.java:132) ~[ei-repository-library-0.0.68.jar!/:?]

at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) ~[?:1.8.0_191]

... 1 more

Caused by: java.util.concurrent.TimeoutException

Do we have to change any configurations while creating the RestClient. I am not sure why it is happening.

is there any chance the stack trace is even longer? from a quick peek it looks, as if a HTTP request is timing out while being sent to elasticsearch. Could this happen?

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