-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add -noReconnectAfter
option
#738
Conversation
This option allows to abort retrying after a given timeout in seconds. Interactive testing * Inbound TCP ** On initial connection ✅ ** On disconnect ✅ * Websocket ** Initial connection ❌: `-noReconnect` not implemented ** On disconnect ✅
Right, this is a known bug that could be addressed separately. |
Does this need to be an option, or can we just hard-code a timeout of (say) one hour? I guess that could break some use case involving a static agent connected to a controller which is down for maintenance over a long weekend? |
I could give the option a sensible default value, but I think one hour may be too short, considering some maintenance followed by a startup sequence on slow hardware for the controller. Maybe one day? |
Not sure. I guess making the timeout opt-in makes sense in that it can be set by all cloud plugins, as a complement for example to jenkinsci/kubernetes-plugin#1543; and anyone using static agents can decide for themselves if it is helpful. |
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.
Looks good so far.
src/main/java/hudson/remoting/DurationSecondsOptionHandler.java
Outdated
Show resolved
Hide resolved
@@ -740,9 +750,14 @@ public void closeRead() throws IOException { | |||
if (noReconnect) { | |||
return; | |||
} | |||
firstAttempt = Instant.now(); |
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.
(WS reconnect)
@@ -795,14 +810,18 @@ private void innerRun(IOHub hub, SSLContext context, ExecutorService service) { | |||
|
|||
try { | |||
boolean first = true; | |||
firstAttempt = Instant.now(); |
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.
TCP initial connection?
@@ -915,7 +934,7 @@ private void innerRun(IOHub hub, SSLContext context, ExecutorService service) { | |||
} | |||
if(noReconnect) | |||
return; // exit | |||
|
|||
firstAttempt = Instant.now(); |
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.
TCP reconnect?
@@ -682,6 +690,7 @@ private List<String> parseJnlpArguments() throws ParserConfigurationException, S | |||
throw new IOException("-jnlpCredentials and -secret are mutually exclusive"); | |||
} | |||
} | |||
Instant firstAttempt = Instant.now(); |
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.
Fine though this mode is deprecated so we do not really need to add enhancements to it.
@@ -401,8 +407,13 @@ public void waitForReady() throws InterruptedException { | |||
String oldName = t.getName(); | |||
try { | |||
int retries = 0; | |||
Instant firstAttempt = Instant.now(); |
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.
(TCP discovery via HTTP)
(complements #676 I think) |
public final class DurationFormatter { | ||
private DurationFormatter(){} | ||
|
||
public static String format(Duration d) { |
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.
|
||
public static Unit fromSuffix(String suffix) { | ||
for (Unit candidate : values()) { | ||
if (candidate.suffix.equals(suffix.toLowerCase(Locale.ROOT))) { |
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.
https://find-sec-bugs.github.io/bugs.htm#IMPROPER_UNICODE seems to be triggering improperly, since use of Locale.ROOT
should be safe AFAIK.
Is there a corresponding PR to |
Unfortunately no, there isn't. |
This option allows to abort retrying after a given timeout expressed in simple form (e.g.
1d
,2h
,10m
,60s
, ...)Downstream work to include this option in the docker image for agents: jenkinsci/docker-agent#802Testing done
Interactive testing
Inbound TCP
Websocket
-noReconnect
not implementedSubmitter checklist