-
Notifications
You must be signed in to change notification settings - Fork 557
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
fix client not retry when Connection refused #2063
base: main
Are you sure you want to change the base?
Conversation
Fix conflict. Would you please review again ? @Paultagoras |
LOG.warn("Failed to connect to '{}': {}", server.getHost(), e.getMessage()); | ||
throw new ClientException("Failed to connect", e); | ||
} catch (ConnectionRequestTimeoutException | ServerException | NoHttpResponseException | ClientException | SocketTimeoutException e) { | ||
} catch (ConnectionRequestTimeoutException | ServerException | NoHttpResponseException | ClientException | SocketTimeoutException | ConnectException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this change still? We modified shouldRetry(...) to now check the cause of the exception as well (rather than just the exception itself):
if (ex instanceof ConnectException
|| ex instanceof ConnectTimeoutException
|| ex.getCause() instanceof ConnectException
|| ex.getCause() instanceof ConnectTimeoutException) {
return retryCauses.contains(ClientFaultCause.ConnectTimeout);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paultagoras Yes. Because you wrapped the origional exception to ClientException
before, it's not a ConnectException
again.
So I move the ConnectException
to:
catch (..... e) {
throws e;
}
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paultagoras @abcfy2 I think we need test first that reproduces the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paultagoras @abcfy2 I think we need test first that reproduces the problem.
@Paultagoras It's easy to reproduce. Just restart the clickhouse service during client is working.
Summary
Sometime when server is busy or temporary down (may restarted later), will see this error:
But
HttpHostConnectException
isClientFaultCause.ConnectTimeout
which should retry by default.This PR will solve this issue.