summaryrefslogtreecommitdiffstats
path: root/zkfacade
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2020-11-11 11:29:43 +0100
committerHåkon Hallingstad <hakon@verizonmedia.com>2020-11-11 11:29:43 +0100
commitbc5622d890eeefd7a180f1c057a6a41ca9614ed5 (patch)
tree320bb5a9c00fd3fc9952575e905198baa36d87c7 /zkfacade
parent158549f21554108c93062536ab34ee12fa19905f (diff)
Fix thread lock detection bug
The effect of the bug was that a deadlock would be reported as long as the current thread T0 that tries to acquire the ZK path P0 is in the following situation: 1. Thread T0 tries to acquire ZK path P0, held by T1. 2. Thread T1 tries to acquire ZK path P1, held by T2. Instead, T2 would need to equal T0. Or, 3. Thread T2 tries to acquire ZK path P2, held by T3 = one of (T0, T1). etc.
Diffstat (limited to 'zkfacade')
-rw-r--r--zkfacade/src/main/java/com/yahoo/vespa/curator/stats/ThreadLockStats.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/zkfacade/src/main/java/com/yahoo/vespa/curator/stats/ThreadLockStats.java b/zkfacade/src/main/java/com/yahoo/vespa/curator/stats/ThreadLockStats.java
index 70442e4833d..73ce731390d 100644
--- a/zkfacade/src/main/java/com/yahoo/vespa/curator/stats/ThreadLockStats.java
+++ b/zkfacade/src/main/java/com/yahoo/vespa/curator/stats/ThreadLockStats.java
@@ -189,7 +189,7 @@ public class ThreadLockStats {
if (threadAcquiringLockPath == threadHoldingLockPath) {
// reentry
return;
- } else if (threadsAcquiring.contains(threadAcquiringLockPath)) {
+ } else if (threadsAcquiring.contains(threadHoldingLockPath)) {
// deadlock
getGlobalLockMetrics(pathToAcquire).incrementDeadlockCount();
logger.warning(errorMessage.toString());
@@ -201,7 +201,7 @@ public class ThreadLockStats {
return;
}
- threadsAcquiring.add(threadHoldingLockPath);
+ threadsAcquiring.add(threadAcquiringLockPath);
lockPath = nextLockPath.get();
threadAcquiringLockPath = threadHoldingLockPath;
}