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

Java 9+ instrumentation without VM options #136

Closed
4 tasks done
ndkoval opened this issue Nov 25, 2022 · 3 comments
Closed
4 tasks done

Java 9+ instrumentation without VM options #136

ndkoval opened this issue Nov 25, 2022 · 3 comments
Assignees

Comments

@ndkoval
Copy link
Collaborator

ndkoval commented Nov 25, 2022

The current model checking implementation requires the following VM options to be added:

--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/jdk.internal.util=ALL-UNNAMED

We can overcome this restriction by transforming classes via a dynamically attached Java agent. See #249.

Subtasks to do:

  • Check on the Kotlin Coroutines build - 3d
  • Investigate whether we need beforeMethodCall[1,2,3,..] optimizations - 0.5d
  • Cleanup - 1.5d
  • Code review - 3d
@ndkoval
Copy link
Collaborator Author

ndkoval commented Dec 9, 2022

The best option (if it works) would be transforming classes via a special java agent.

@jifang
Copy link

jifang commented Nov 23, 2023

Hello, I am still getting the error when running with model check, even with the JVM options set. I was using the sample code from the official doc.

class Counter<T> {
    // The following line will generate the error
    private val size = AtomicInteger(0)
    @Volatile
    private var value = 0

    fun inc(): Int = ++value
    fun get() = value
}

class BasicCounterTest {
    private val c = Counter<Int>() // Initial state

    // Operations on the Counter
    @Operation
    fun inc() = c.inc()

    @Operation
    fun get() = c.get()

    @Test // JUnit
    fun modelCheckingTest() = ModelCheckingOptions().check(this::class)
}

error.log

@ndkoval ndkoval linked a pull request Jan 17, 2024 that will close this issue
@ndkoval ndkoval removed a link to a pull request Jan 18, 2024
@ndkoval ndkoval linked a pull request Jan 18, 2024 that will close this issue
@ndkoval ndkoval assigned eupp and unassigned ndkoval and avpotapov00 Apr 16, 2024
@ndkoval
Copy link
Collaborator Author

ndkoval commented Apr 19, 2024

Fixed under #285 and #296

@ndkoval ndkoval closed this as completed Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants