From dab8a19d78103380904a4ce814cb22dc7f39128e Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 28 May 2020 15:02:36 +0200 Subject: [PATCH 1/2] Capture stacktrace from the original thread when SlaveComputer#_connect fails --- core/src/main/java/hudson/slaves/SlaveComputer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java index c6d1c56019..59c72ce47d 100644 --- a/core/src/main/java/hudson/slaves/SlaveComputer.java +++ b/core/src/main/java/hudson/slaves/SlaveComputer.java @@ -283,6 +283,7 @@ public class SlaveComputer extends Computer { logger.fine("Forcing a reconnect on "+getName()); closeChannel(); + Exception threadInfo = new Exception(); return lastConnectActivity = Computer.threadPoolForRemoting.submit(() -> { // do this on another thread so that the lengthy launch operation // (which is typical) won't block UI thread. @@ -295,16 +296,20 @@ public class SlaveComputer extends Computer { offlineCause = null; launcher.launch(SlaveComputer.this, taskListener); } catch (AbortException e) { + e.addSuppressed(threadInfo); taskListener.error(e.getMessage()); throw e; } catch (IOException e) { + e.addSuppressed(threadInfo); Util.displayIOException(e,taskListener); Functions.printStackTrace(e, taskListener.error(Messages.ComputerLauncher_unexpectedError())); throw e; } catch (InterruptedException e) { + e.addSuppressed(threadInfo); Functions.printStackTrace(e, taskListener.error(Messages.ComputerLauncher_abortedLaunch())); throw e; } catch (Exception e) { + e.addSuppressed(threadInfo); Functions.printStackTrace(e, taskListener.error(Messages.ComputerLauncher_unexpectedError())); throw e; } From 97e8d17ef37976739242d0d590895ba1d95df2cc Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 28 May 2020 15:27:01 +0200 Subject: [PATCH 2/2] Update core/src/main/java/hudson/slaves/SlaveComputer.java Co-authored-by: Jesse Glick --- core/src/main/java/hudson/slaves/SlaveComputer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java index 59c72ce47d..7e717744d9 100644 --- a/core/src/main/java/hudson/slaves/SlaveComputer.java +++ b/core/src/main/java/hudson/slaves/SlaveComputer.java @@ -283,7 +283,7 @@ public class SlaveComputer extends Computer { logger.fine("Forcing a reconnect on "+getName()); closeChannel(); - Exception threadInfo = new Exception(); + Throwable threadInfo = new Throwable("launched here"); return lastConnectActivity = Computer.threadPoolForRemoting.submit(() -> { // do this on another thread so that the lengthy launch operation // (which is typical) won't block UI thread.