You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class RecursiveSpinLockRepeatsOperationTest {
private val value = AtomicBoolean(false)
fun foo() {
if (value.get()) return
foo()
}
@Test
fun test() = ModelCheckingOptions()
.iterations(0)
.addCustomScenario { parallel { thread { actor(::foo) } } }
.checkImpl(this::class.java)
.checkLincheckOutput("spin_lock/recursive_spin_lock_repeats_operation.txt")
}
Lincheck produces an incorrect spin-lock
The following interleaving leads to the error:
| ------------------------------------------------------------------------------------------------- |
| Thread 1 |
| ------------------------------------------------------------------------------------------------- |
| foo(): <hung> |
| /* The following events repeat infinitely: */ |
| ┌╶> value.get(): false at RecursiveSpinLockRepeatsOperationTest.foo(RecursiveSpinLockTest.kt:301) |
| └╶╶ switch (reason: active lock detected) |
| ------------------------------------------------------------------------------------------------- |
All unfinished threads are in deadlock
The text was updated successfully, but these errors were encountered:
The problem is because in the ManagedStrategy class we treat the top-most function (the actor) not as a regular method call. We should refactor this to prevent this bug and similar bugs.
On the following test
Lincheck produces an incorrect spin-lock
The text was updated successfully, but these errors were encountered: