-
-
Notifications
You must be signed in to change notification settings - Fork 276
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: add exponential backoff #541
Conversation
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.
The idea seems fine. Exponential backoff can be useful. In this case, we need an associated Jira ticket that sufficiently describes the problem and some indication that this resolves or improves the situation.
import java.net.Socket; | ||
import java.net.URI; | ||
import java.net.URL; | ||
import java.net.*; |
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.
Please don't combine imports. They should be one per line.
Also, it would be nice if the reformatting were separated. At least in a separate commit. Maybe a separate PR.
@@ -72,6 +72,11 @@ THE SOFTWARE. | |||
</properties> | |||
|
|||
<dependencies> | |||
<dependency> |
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.
Generally we don't like to add dependencies to Remoting, but this one is small, so it's probably okay.
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.
Though do we really need a third-party dependency for exponential backoff? Remoting already retries connection, and typically you need to tune backoff behavior a bit for the caller anyway. E.g. https://github.com/jenkinsci/apache-httpcomponents-client-4-api-plugin/blob/4e7d9a7bae61f816f95f6fc1fb144e6ed40895f1/src/main/java/io/jenkins/plugins/httpclient/RobustHTTPClient.java#L159-L216
@@ -236,6 +232,8 @@ public Thread newThread(@NonNull final Runnable r) { | |||
private final String instanceIdentity; | |||
private final Set<String> protocols; | |||
|
|||
private Integer retryAttempts; |
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.
Any reason not to use primitives?
Merge conflict, possibly with #603 etc. The idea is fine but this is probably a candidate for closing unless the author still has time and interest in cleaning it up. |
Probably superseded by #676. |
I faced with DNS/timeout issues during agent initialization
WebSocket mode
TCP socket mode
I'm trying to detect exact issue. Seems it relates to some K8s/JDK networking corner case.
Anyway the PR introduces exponential backoff workaround which resolves the issue on source code level. It can help to avoid potential network issues.