Merge pull request #4754 from Vlatombe/capture-slavecomputer-threadinfo

Capture stacktrace from the original thread when SlaveComputer#_connect fails
This commit is contained in:
Tim Jacomb authored and GitHub committed 2020-05-31 07:25:32 +01:00
commit de866dffdf
1 file changed
+5
@@ -283,6 +283,7 @@ public class SlaveComputer extends Computer {
logger.fine("Forcing a reconnect on "+getName());
closeChannel();
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.
@@ -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;
}