Skip to content

Got Request execution cancelled for every requests after an OutOfMemoryError #2979

Open
@OlivierToth-itsf

Description

@OlivierToth-itsf

Hi,

I found that if I have an OutOfMemoryError when querying "too big object" from elasticsearch, my application does not crash, but any further request will be cancelled with this error :

Unexpected exception thrown: java.lang.RuntimeException: Request execution cancelled
org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.RuntimeException: Request execution cancelled
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
	at org.junit.jupiter.api.AssertDoesNotThrow.createAssertionFailedError(AssertDoesNotThrow.java:84)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:75)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:58)
	at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3228)
	at test.es_crash.service.StubServiceTest.test(StubServiceTest.java:81)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: Request execution cancelled
	at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:942)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:304)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:292)
	at co.elastic.clients.transport.rest_client.RestClientHttpClient.performRequest(RestClientHttpClient.java:91)
	at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:144)
	at co.elastic.clients.elasticsearch.ElasticsearchClient.get(ElasticsearchClient.java:910)
	at org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate.lambda$get$0(ElasticsearchTemplate.java:140)
	at org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate.execute(ElasticsearchTemplate.java:683)
	at org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate.get(ElasticsearchTemplate.java:140)
	at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.get(AbstractElasticsearchTemplate.java:272)
	at test.es_crash.service.StubService.get(StubService.java:27)
	at test.es_crash.service.StubServiceTest.lambda$test$2(StubServiceTest.java:81)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:71)
	... 6 more
Caused by: java.util.concurrent.CancellationException: Request execution cancelled
	at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.execute(CloseableHttpAsyncClientBase.java:114)
	at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:138)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:300)
	... 17 more

I created a sample project here https://github.com/OlivierToth-itsf/Spring-and-Es-crash .
If you run the test case StubServiceTest.test you will see my problem.

(I made many call in parallel in order to force the OOM).

Is this a bug or I misconfigured my project ?

Configuration
Springboot: 3.3.3
Java: 17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions