Skip to content

Commit

Permalink
Fix request timeout in HeapAttack tests (elastic#104336)
Browse files Browse the repository at this point in the history
I noticed we're using 5 minutes for both query timeout and triggering 
the out-of-memory action in heap attack tests. This means when we're
generating the heap dump, and some ESQL tasks might get canceled because
the connection was disconnected. This PR increases the query timeout to
6 minutes instead.
  • Loading branch information
dnhatn authored Jan 22, 2024
1 parent 3493e42 commit 668ae50
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private Response query(String query, String filterPath) throws IOException {
request.setJsonEntity(query.toString().replace("\n", "\\n"));
request.setOptions(
RequestOptions.DEFAULT.toBuilder()
.setRequestConfig(RequestConfig.custom().setSocketTimeout(Math.toIntExact(TimeValue.timeValueMinutes(5).millis())).build())
.setRequestConfig(RequestConfig.custom().setSocketTimeout(Math.toIntExact(TimeValue.timeValueMinutes(6).millis())).build())
.setWarningsHandler(WarningsHandler.PERMISSIVE)
);
logger.info("--> test {} started querying", getTestName());
Expand All @@ -330,6 +330,10 @@ protected void doRun() throws Exception {
TimeValue elapsed = TimeValue.timeValueNanos(System.nanoTime() - startedTimeInNanos);
logger.info("--> test {} triggering OOM after {}", getTestName(), elapsed);
Request triggerOOM = new Request("POST", "/_trigger_out_of_memory");
RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(Math.toIntExact(TimeValue.timeValueMinutes(2).millis()))
.build();
request.setOptions(RequestOptions.DEFAULT.toBuilder().setRequestConfig(requestConfig));
client().performRequest(triggerOOM);
}
}, TimeValue.timeValueMinutes(5), testThreadPool.executor(ThreadPool.Names.GENERIC));
Expand Down

0 comments on commit 668ae50

Please sign in to comment.