Skip to content

Commit 3d5309d

Browse files
committed
[JENKINS-42048] If there is a problem contacting the node, as has been reported for kubernetes, print one message only.
Stack traces and details of subsequent connection problems are already available in a FINE logger.
1 parent 7b86df6 commit 3d5309d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static final class Execution extends AbstractStepExecutionImpl implements Runnab
140140
private transient FilePath ws;
141141
private transient long recurrencePeriod;
142142
private transient volatile ScheduledFuture<?> task, stopTask;
143+
private transient boolean printedCannotContactMessage;
143144
private Controller controller;
144145
private String node;
145146
private String remote;
@@ -184,7 +185,10 @@ static final class Execution extends AbstractStepExecutionImpl implements Runnab
184185
// RequestAbortedException, ChannelClosedException, EOFException, wrappers thereof; InterruptedException if it just takes too long.
185186
LOGGER.log(Level.FINE, node + " is evidently offline now", x);
186187
ws = null;
187-
logger().println("Cannot contact " + node + ": " + x); // TODO should we throttle messages of this type; e.g., exponentially slow them down?
188+
if (!printedCannotContactMessage) {
189+
logger().println("Cannot contact " + node + ": " + x);
190+
printedCannotContactMessage = true;
191+
}
188192
return null;
189193
}
190194
if (!directory) {
@@ -324,7 +328,10 @@ private void check() {
324328
} catch (Exception x) {
325329
LOGGER.log(Level.FINE, "could not check " + workspace, x);
326330
ws = null;
327-
logger().println("Cannot contact " + node + ": " + x); // TODO as above
331+
if (!printedCannotContactMessage) {
332+
logger().println("Cannot contact " + node + ": " + x);
333+
printedCannotContactMessage = true;
334+
}
328335
}
329336
}
330337

0 commit comments

Comments
 (0)