Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat first actor (operation) as regular method call #452

Open
eupp opened this issue Jan 28, 2025 · 1 comment
Open

Treat first actor (operation) as regular method call #452

eupp opened this issue Jan 28, 2025 · 1 comment
Labels
bug Something isn't working refactoring

Comments

@eupp
Copy link
Collaborator

eupp commented Jan 28, 2025

On the following test

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
@eupp eupp added bug Something isn't working refactoring labels Jan 28, 2025
@eupp
Copy link
Collaborator Author

eupp commented Jan 28, 2025

Related to #453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactoring
Projects
None yet
Development

No branches or pull requests

1 participant