Skip to content

Conversation

@swallez
Copy link
Member

@swallez swallez commented May 31, 2022

The default configuration of the Low Level Rest Client is to buffer the response body up to 100 MB. If that threshold is exceeded, a ContentTooLargeException is thrown in the lower layers of LLRC.

When such an exception occurs, LLRC will retry the request, which has some bad side effects:

  • for idempotent requests like a regular search, there's no point in retrying since the response will always be too large.
  • for scroll searches, retrying will move to the next scroll slice. With a cluster big enough or a number of scroll slices small enough, retrying may reach the last scroll slice, which is usually be smaller and may fit into the buffer limit. From an application perspective, the request will have succeeded with the last slice as result, despite having effectively skipped a large amount of results.

This PR fixes that, by ensuring that no retry happens if a request fails with a ContentTooLargeException.

Fixes #86041.

I added the v6.8.24 label to backport to 6.8 as this was found by a customer still using 6.8 and even if there's no additional 6.8 release, they may want to use a snapshot version with the fix.

@swallez swallez added >bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch v6.8.24 v7.17.5 v8.3.1 labels May 31, 2022
@elasticmachine elasticmachine added the Team:Clients Meta label for clients team label May 31, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/clients-team (Team:Clients)

@elasticsearchmachine elasticsearchmachine added v8.4.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels May 31, 2022
@elasticsearchmachine
Copy link
Collaborator

Hi @swallez, I've created a changelog YAML for you.

private static boolean isRetryableException(Throwable e) {
if (e instanceof ExecutionException) {
e = e.getCause();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say it'd be better to use the try in the caller, but seeing this thing, I get why you didn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Clients Meta label for clients team v6.8.24 v7.17.5 v8.3.1 v8.4.0

4 participants