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

jdk22 serviceability jvmti GetThreadStateMountedTest: Fatal error in JVMTI SuspendThread #18810

Closed
babsingh opened this issue Jan 24, 2024 · 0 comments · Fixed by adoptium/aqa-tests#5114

Comments

@babsingh
Copy link
Contributor

https://openj9-jenkins.osuosl.org/job/Test_openjdk22_j9_extended.openjdk_aarch64_linux_Personal/1
serviceability_jvmti_j9_0
serviceability_jvmti_j9_1
serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java

19:09:10  STDOUT:
19:09:10  >>JVMTI_THREAD_STATE_RUNNABLE
19:09:10  Thread VirtualThread[#27]/runnable@ForkJoinPool-1-worker-1
19:09:10  cthread state(91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10  vthread state(5):  ALIVE RUNNABLE
19:09:10  suspend cthread
19:09:10  cthread state(100091):  ALIVE WAITING WAITING_INDEFINITELY SUSPENDED
19:09:10  vthread state(5):  ALIVE RUNNABLE
19:09:10  suspend vthread
19:09:10  cthread state(100091):  ALIVE WAITING WAITING_INDEFINITELY SUSPENDED
19:09:10  vthread state(100005):  ALIVE RUNNABLE SUSPENDED
19:09:10  resume cthread
19:09:10  cthread state(91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10  vthread state(100005):  ALIVE RUNNABLE SUSPENDED
19:09:10  interrupt vthread
19:09:10  cthread state(200091):  ALIVE WAITING WAITING_INDEFINITELY INTERRUPTED
19:09:10    ERROR: some unexpected bits are set (200000):  INTERRUPTED
19:09:10    expected 'strong' state (91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(300005):  ALIVE RUNNABLE SUSPENDED INTERRUPTED
19:09:10  resume vthread
19:09:10  <<JVMTI_THREAD_STATE_RUNNABLE - FAILED
19:09:10  
19:09:10  >>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
19:09:10  Thread VirtualThread[#29]/blocked@ForkJoinPool-1-worker-1
19:09:10  cthread state(200401):  ALIVE BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    ERROR: some mandatory bits are not set (90):  WAITING WAITING_INDEFINITELY
19:09:10    ERROR: some unexpected bits are set (200400):  BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    expected 'strong' state (91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(200401):  ALIVE BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    ERROR: some unexpected bits are set (200000):  INTERRUPTED
19:09:10    expected 'strong' state (401):  ALIVE BLOCKED_ON_MONITOR_ENTER
19:09:10    expected 'weak' state (0): <none>
19:09:10  suspend cthread
19:09:10  cthread state(300401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED INTERRUPTED
19:09:10    ERROR: some mandatory bits are not set (90):  WAITING WAITING_INDEFINITELY
19:09:10    ERROR: some unexpected bits are set (200400):  BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    expected 'strong' state (100091):  ALIVE WAITING WAITING_INDEFINITELY SUSPENDED
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(200401):  ALIVE BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    ERROR: some unexpected bits are set (200000):  INTERRUPTED
19:09:10    expected 'strong' state (401):  ALIVE BLOCKED_ON_MONITOR_ENTER
19:09:10    expected 'weak' state (0): <none>
19:09:10  suspend vthread
19:09:10  cthread state(300401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED INTERRUPTED
19:09:10    ERROR: some mandatory bits are not set (90):  WAITING WAITING_INDEFINITELY
19:09:10    ERROR: some unexpected bits are set (200400):  BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    expected 'strong' state (100091):  ALIVE WAITING WAITING_INDEFINITELY SUSPENDED
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(300401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED INTERRUPTED
19:09:10    ERROR: some unexpected bits are set (200000):  INTERRUPTED
19:09:10    expected 'strong' state (100401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED
19:09:10    expected 'weak' state (0): <none>
19:09:10  resume cthread
19:09:10  cthread state(200401):  ALIVE BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    ERROR: some mandatory bits are not set (90):  WAITING WAITING_INDEFINITELY
19:09:10    ERROR: some unexpected bits are set (200400):  BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    expected 'strong' state (91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(300401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED INTERRUPTED
19:09:10    ERROR: some unexpected bits are set (200000):  INTERRUPTED
19:09:10    expected 'strong' state (100401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED
19:09:10    expected 'weak' state (0): <none>
19:09:10  interrupt vthread
19:09:10  cthread state(200401):  ALIVE BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    ERROR: some mandatory bits are not set (90):  WAITING WAITING_INDEFINITELY
19:09:10    ERROR: some unexpected bits are set (200400):  BLOCKED_ON_MONITOR_ENTER INTERRUPTED
19:09:10    expected 'strong' state (91):  ALIVE WAITING WAITING_INDEFINITELY
19:09:10    expected 'weak' state (0): <none>
19:09:10  vthread state(300401):  ALIVE BLOCKED_ON_MONITOR_ENTER SUSPENDED INTERRUPTED
19:09:10  resume vthread
19:09:10  <<JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER - FAILED
19:09:10  
19:09:10  >>JVMTI_THREAD_STATE_WAITING_INDEFINITELY
19:09:10  suspend vthread (0)
19:09:10  check_jvmti_status: JVMTI function returned error: JVMTI_ERROR_THREAD_NOT_ALIVE (15)
19:09:10  STDERR:
19:09:10  
19:09:10  Fatal error: error in JVMTI SuspendThread
@babsingh babsingh added this to the Java 22 milestone Jan 24, 2024
babsingh added a commit to babsingh/openj9 that referenced this issue Feb 13, 2024
New behaviour was noticed in JTREG GetThreadStateMountedTest.

An unmounted carrier thread is considered implicitly parked,
and all other bits except ALIVE and SUSPENDED are removed from
the bitmask.

Related: eclipse-openj9#18810

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Feb 15, 2024
JVMTI InterruptThread needs to invoke j.l.VirtualThread.interrupt()
to interrupt a virtual thread as per the RI.

Related: eclipse-openj9#18810

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Feb 27, 2024
In JDK19+, multiple thread objects can be associated to a J9VMThread:
a virtual thread and its carrier thread.

If a virtual thread is mounted, then the carrier thread is unmounted
and vice-versa. In such cases, J9VMThread's state should not be used
to determine if a thread object is interrupted.

Instead, Thread.interrupted is used to determine if a thread object is
interrupted.

If a mounted thread is suspended, only set Thread.interrupted to TRUE
and do not wake/interrupt the thread. This behaviour is expected in
GetThreadStateMountedTest, which is a test added for virtual threads
in JDK22. These changes are only added for virtual threads in JDK19+.

Related: eclipse-openj9#18810

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Feb 28, 2024
In JDK19+, multiple thread objects can be associated to a J9VMThread:
a virtual thread and its carrier thread.

If a virtual thread is mounted, then the carrier thread is unmounted
and vice-versa. In such cases, J9VMThread's state should not be used
to determine if a thread object is interrupted.

Instead, Thread.interrupted is used to determine if a thread object is
interrupted.

If a mounted thread is suspended, only set Thread.interrupted to TRUE
and do not wake/interrupt the thread. This behaviour is expected in
GetThreadStateMountedTest, which is a test added for virtual threads
in JDK22. These changes are only added for virtual threads in JDK19+.

Related: eclipse-openj9#18810

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/aqa-tests that referenced this issue Feb 29, 2024
smlambert pushed a commit to adoptium/aqa-tests that referenced this issue Mar 1, 2024
babsingh added a commit to babsingh/openj9 that referenced this issue Mar 26, 2024
In JDK19+, multiple thread objects can be associated to a J9VMThread:
a virtual thread and its carrier thread.

If a virtual thread is mounted, then the carrier thread is unmounted
and vice-versa. In such cases, J9VMThread's state should not be used
to determine if a thread object is interrupted.

Instead, Thread.interrupted is used to determine if a thread object is
interrupted.

If a mounted thread is suspended, only set Thread.interrupted to TRUE
and do not wake/interrupt the thread. This behaviour is expected in
GetThreadStateMountedTest, which is a test added for virtual threads
in JDK22. These changes are only added for virtual threads in JDK19+.

Related: eclipse-openj9#18810

Signed-off-by: Babneet Singh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants