Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-03-01 16:48:11 -0500
committerJeff Johnston2018-03-01 17:48:12 -0500
commit137d13c1fde3e2b4d7184ce57222b61f16738257 (patch)
treeca18d7e106f022033d319451cddf22f7a1bb0d6a
parent6ae9ece869084644bb68863ff8e73df95584e79a (diff)
downloadorg.eclipse.linuxtools-137d13c1fde3e2b4d7184ce57222b61f16738257.tar.gz
org.eclipse.linuxtools-137d13c1fde3e2b4d7184ce57222b61f16738257.tar.xz
org.eclipse.linuxtools-137d13c1fde3e2b4d7184ce57222b61f16738257.zip
Bug 531883 - Deadlock in Docker when connection closesv6.2.1stable-6.2
- in DockerConnection, move the setState() call in close() outside of the clientLock - in setState(), protect the setting of the global containers and images lists using the containerLock and imageLock respectively - this will avoid notification from occuring within a clientLock Change-Id: Ia5e942b15ba8b5db95d1ac1596c135273cb999fb Reviewed-on: https://git.eclipse.org/r/118463 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index e98ad4d8b3..142eee7660 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -318,9 +318,13 @@ public class DockerConnection
switch (state) {
case UNKNOWN:
case CLOSED:
- this.images = Collections.emptyList();
- this.containers = Collections.emptyList();
- this.containersById = new HashMap<>();
+ synchronized (imageLock) {
+ this.images = Collections.emptyList();
+ }
+ synchronized (containerLock) {
+ this.containers = Collections.emptyList();
+ this.containersById = new HashMap<>();
+ }
notifyContainerListeners(this.containers);
notifyImageListeners(this.images);
break;
@@ -372,8 +376,8 @@ public class DockerConnection
this.client.close();
this.client = null;
}
- setState(EnumDockerConnectionState.CLOSED);
}
+ setState(EnumDockerConnectionState.CLOSED);
}
@Override

Back to the top