Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StandardHttpClient.retryWithExponentialBackoff leads to TimeoutException hiding underlying issues #5095

Closed
manusa opened this issue May 4, 2023 · 0 comments · Fixed by #5099
Assignees
Labels
Milestone

Comments

@manusa
Copy link
Member

manusa commented May 4, 2023

Description

The changes to provide a generic retry approach (#4825 #4788) in combination with OperationSupport.waitForResult and the default retry values:

protected <T> T waitForResult(CompletableFuture<T> future) throws IOException {
try {
// since readTimeout may not be enforced in a timely manner at the httpclient, we'll
// enforce a higher level timeout with a small amount of padding to account for possible queuing
if (getRequestConfig().getRequestTimeout() > 0) {
return future.get(getRequestConfig().getRequestTimeout() + ADDITIONAL_REQEUST_TIMEOUT, TimeUnit.MILLISECONDS);
}
return future.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
InterruptedIOException ie = new InterruptedIOException();
ie.initCause(e);
throw ie;
} catch (ExecutionException e) {
Throwable t = e;
if (e.getCause() != null) {
t = e.getCause();
}
// throw a new exception to preserve the calling stack trace
if (t instanceof IOException) {
throw new IOException(t.getMessage(), t);
}
if (t instanceof KubernetesClientException) {
throw ((KubernetesClientException) t).copyAsCause();
}
throw new KubernetesClientException(t.getMessage(), t);
} catch (TimeoutException e) {
future.cancel(true);
throw KubernetesClientException.launderThrowable(e);
}
}

lead to TimeoutException that hides the underlying issue that's causing the overhead with the retry and backoff intervals.

We should try to find a way to report the last/latest status code/message (if any) and report it when the timeout happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants