Add comments about possible lock contention
Bug: 149308087
Test: TreeHugger
Change-Id: I06f03e48945d725d4722c297dba200361fd9dce2
diff --git a/test/1932-monitor-events-misc/src/art/Test1932.java b/test/1932-monitor-events-misc/src/art/Test1932.java
index 7f66884..aee811a 100644
--- a/test/1932-monitor-events-misc/src/art/Test1932.java
+++ b/test/1932-monitor-events-misc/src/art/Test1932.java
@@ -222,6 +222,7 @@
controller2.DoLock();
controller2.waitForLockToBeHeld();
controller2.DoNotifyAll();
+ // See comment in testWaitMonitorEnter.
controller2.DoUnlock();
controller1.waitForLockToBeHeld();
controller1.DoUnlock();
@@ -249,6 +250,10 @@
controller2.DoLock();
controller2.waitForLockToBeHeld();
controller2.DoNotifyAll();
+ // We've seen extra messages about contended locking here. They're OK if e.g. controller1
+ // wakes up spuriously before the notification, which is allowed. But in the normal case,
+ // we should not see contended locking here. And the extra messages seem rare enough that
+ // we can tolerate the spurious failures to catch more bugs. See b/149308087.
controller2.DoUnlock();
controller1.waitForLockToBeHeld();
controller1.DoUnlock();
@@ -275,6 +280,7 @@
controller1.DoLock();
controller1.waitForLockToBeHeld();
controller1.DoNotifyAll();
+ // See comment in testWaitMonitorEnter.
controller2.waitForLockToBeHeld();
controller2.DoUnlock();
}
@@ -307,6 +313,7 @@
controller1.DoLock();
controller1.waitForLockToBeHeld();
controller1.DoNotifyAll();
+ // See comment in testWaitMonitorEnter.
controller1.DoUnlock();
// Wait for controller3 to have locked.
// We cannot use waitForLockToBeHeld since we could race with the HANDLER waitForLockToBeHeld
@@ -349,6 +356,7 @@
controller1.DoLock();
controller1.waitForLockToBeHeld();
controller1.DoNotifyAll();
+ // See comment in testWaitMonitorEnter.
controller1.DoUnlock();
controller2.waitForLockToBeHeld();
controller2.DoUnlock();
@@ -418,6 +426,7 @@
controller2.DoLock();
controller2.waitForLockToBeHeld();
controller2.DoNotifyAll();
+ // See comment in testWaitMonitorEnter.
controller2.DoUnlock();
try {
controller1.waitForLockToBeHeld();