aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-05-31 18:54:08 -0400
committerJeff Johnston2018-05-31 19:27:48 -0400
commit40bd29178c0b1eaa5792780b35b3cdd4402f7fc9 (patch)
treec071da421a8252fd62aeefed2068d57f9ed4f97f
parent634a212204e5fd5e156669c5bd2f411e578621cd (diff)
downloadorg.eclipse.linuxtools-40bd29178c0b1eaa5792780b35b3cdd4402f7fc9.tar.gz
org.eclipse.linuxtools-40bd29178c0b1eaa5792780b35b3cdd4402f7fc9.tar.xz
org.eclipse.linuxtools-40bd29178c0b1eaa5792780b35b3cdd4402f7fc9.zip
Bug 535421 - AttachLog can stall and cause CDT Container build freeze
- modify ContainerCommandProcess waitFor() and destroy() methods to use close of attachLog token to kill the log when needed (current method of closing piped streams doesn't work, nor does interrupting thread or trying to stop it) - remove the stack trace print in the log thread and add a new catch clause for any Exception so that when we close the attachLog token we don't get an exception listed in the error log Change-Id: I11051412e86bb1e70daa6798ec08d7b35c81b8a8 Reviewed-on: https://git.eclipse.org/r/123778 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
index ab10415cfe..56b608e030 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
@@ -59,6 +59,7 @@ public class ContainerCommandProcess extends Process {
private Map<String, String> remoteVolumes;
private boolean keepContainer;
private Thread thread;
+ private Closeable token;
private boolean containerRemoved;
private int exitValue;
private boolean done;
@@ -106,6 +107,7 @@ public class ContainerCommandProcess extends Process {
Closeable inputToken = ((DockerConnection) connection).getOperationToken();
Closeable token = ((DockerConnection) connection)
.getOperationToken()) {
+ this.token = token;
pipedOut = pipedStdout;
pipedErr = pipedStderr;
connection.startContainer(containerId, outputStream);
@@ -134,7 +136,6 @@ public class ContainerCommandProcess extends Process {
pipedStderr.flush();
} catch (DockerException | InterruptedException | IOException e) {
// do nothing but flush/close output streams
- e.printStackTrace();
if (pipedOut != null) {
try {
pipedOut.flush();
@@ -149,6 +150,9 @@ public class ContainerCommandProcess extends Process {
// ignore
}
}
+ } catch (Exception e) {
+ // do nothing as this will occur if we forcefully stop the attachLog via closing
+ // the copy client token
} finally {
threadDone = true;
}
@@ -190,6 +194,7 @@ public class ContainerCommandProcess extends Process {
this.stdout.close();
this.stderr.close();
this.stdin.close();
+ this.token.close();
for (Closeable close : toClose) {
close.close();
}
@@ -252,6 +257,8 @@ public class ContainerCommandProcess extends Process {
containerId.substring(0, 8)));
this.stdout.close();
this.stderr.close();
+ this.stdin.close();
+ this.token.close();
} catch (IOException e) {
// do nothing
}