summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2018-01-31 17:58:12 +0100
committerHarald Musum <musum@oath.com>2018-01-31 17:58:12 +0100
commitd791834dee91671917a2a70a55c7ffdfcf72df60 (patch)
treef538eb6f83f8a0c0d5df4a0c4d383985a92725ab /configserver
parent7338b3fe9d4d20b4cce70fe7c8a8ce527fa232d6 (diff)
Remove synchronization, it leads to deadlocks
Example: Thread A gets the lock in acquire(), does not hold the monitor anymore.. Thread B calls acquire() and waits for the lock (while holding the monitor) Thead A wants to call release(), but cannot do that because thread B is holding the monitor. Deadlock until timeout for thread A, at which time thread B holds the monitor again and continues
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/tenant/ActivateLock.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/ActivateLock.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/ActivateLock.java
index 461992412d2..c49d476c4c4 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/ActivateLock.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/ActivateLock.java
@@ -23,7 +23,7 @@ public class ActivateLock {
this.curatorLock = new CuratorLock(curator, rootPath.append(ACTIVATE_LOCK_NAME).getAbsolute());
}
- public synchronized boolean acquire(TimeoutBudget timeoutBudget, boolean ignoreLockError) {
+ public boolean acquire(TimeoutBudget timeoutBudget, boolean ignoreLockError) {
try {
return curatorLock.tryLock(timeoutBudget.timeLeft().toMillis(), TimeUnit.MILLISECONDS);
} catch (Exception e) {
@@ -34,7 +34,7 @@ public class ActivateLock {
}
}
- public synchronized void release() {
+ public void release() {
if (curatorLock.hasLock()) {
curatorLock.unlock();
}