-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I had a case, where with a large request body and a large timeout, the application crashed with an OutOfMemoryError.
After analyzing the heap dump, I found the reason in RequestFutureManager:
public TarantoolRequestMetadata submitRequest(TarantoolRequest request, int requestTimeout) {
CompletableFuture<Value> requestFuture = new CompletableFuture<>();
TarantoolRequestMetadata requestMetadata = new TarantoolRequestMetadata(request, requestFuture);
long requestId = requestMetadata.getRequestId();
requestFuture.whenComplete((r, e) -> requestFutures.remove(requestId));
requestFutures.put(requestId, requestMetadata);
timeoutScheduler.schedule(() -> {
if (!requestFuture.isDone()) {
requestFuture.completeExceptionally(new TimeoutException(String.format(
"Failed to get response for %s within %d ms", requestMetadata, requestTimeout)));
}
}, requestTimeout, TimeUnit.MILLISECONDS);
return requestMetadata;
}
timeoutScheduler holds requestMetadata for logging even after request has been completed. requestMetadata contains TarantoolRequest with TarantoolRequestBody.
In my example, request body was 250 MB and requestTimeout was 600 seconds, and we send request every 5 seconds, so in 100 seconds we crashed with OutOfMemoryError on 26 GB xmx.
I can assume, that the problem should be solved in such a way that TarantoolRequestMetadata does not contain the request body.
egorskor and a3axapov
Metadata
Metadata
Assignees
Labels
No labels