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

JDK19 serviceability_jvmti_j9_1_FAILED serviceability/jvmti/vthread/SelfSuspendDisablerTest/SelfSuspendDisablerTest.java Test FAILED: Unexpected thread state #16276

Comments

@JasonFengJ9
Copy link
Member

JasonFengJ9 commented Nov 7, 2022

Failure link

From an internal build(rhel7s390x-4-6):

openjdk version "19.0.1" 2022-10-18
IBM Semeru Runtime Open Edition 19.0.1+10 (build 19.0.1+10)
Eclipse OpenJ9 VM 19.0.1+10 (build master-f6c7bee4b, JRE 19 Linux s390x-64-Bit Compressed References 20221018_71 (JIT enabled, AOT enabled)
OpenJ9   - f6c7bee4b
OMR      - 357df2f80
JCL      - 110e1e7808 based on jdk-19.0.1+10)

Rerun in Grinder - Change TARGET to run only the failed test targets.

Optional info

Failure output (captured from console output)

[2022-11-05T17:27:26.328Z] variation: Mode650
[2022-11-05T17:27:26.328Z] JVM_OPTIONS:  -XX:-UseCompressedOops 

[2022-11-05T17:46:43.917Z] TEST: serviceability/jvmti/vthread/SelfSuspendDisablerTest/SelfSuspendDisablerTest.java

[2022-11-05T17:46:43.918Z] STDOUT:
[2022-11-05T17:46:43.918Z] Agent init started
[2022-11-05T17:46:43.918Z] Agent init finished
[2022-11-05T17:46:43.918Z] Expected platform thread state: 000000 got: 000000
[2022-11-05T17:46:43.918Z] Expected virtual  thread state: 000000 got: 000000
[2022-11-05T17:46:43.918Z] Expected platform thread state: 000005 got: 000005
[2022-11-05T17:46:43.918Z] Expected virtual  thread state: 000005 got: 000005
[2022-11-05T17:46:43.918Z] Expected platform thread state: 100005 got: 500005
[2022-11-05T17:46:43.918Z] Timeout refired 960 times
[2022-11-05T17:46:43.918Z] STDERR:
[2022-11-05T17:46:43.918Z] Exception in thread "" java.lang.RuntimeException: Test FAILED: Unexpected thread state
[2022-11-05T17:46:43.918Z] 	at SelfSuspendDisablerTest.testJvmtiThreadState(SelfSuspendDisablerTest.java:67)
[2022-11-05T17:46:43.918Z] 	at SelfSuspendDisablerTest.lambda$main$1(SelfSuspendDisablerTest.java:83)
[2022-11-05T17:46:43.918Z] 	at java.base/java.lang.VirtualThread.run(VirtualThread.java:292)
[2022-11-05T17:46:43.918Z] 	at java.base/java.lang.VirtualThread$VThreadContinuation.lambda$new$0(VirtualThread.java:179)
[2022-11-05T17:46:43.918Z] 	at java.base/jdk.internal.vm.Continuation.execute(Continuation.java:171)

[2022-11-05T17:46:43.918Z] Test results: passed: 112; error: 1
[2022-11-05T17:46:43.918Z] Report written to /home/jenkins/workspace/Test_openjdk19_j9_extended.openjdk_s390x_linux/jvmtest/openjdk/report/html/report.html
[2022-11-05T17:46:43.918Z] Results written to /home/jenkins/workspace/Test_openjdk19_j9_extended.openjdk_s390x_linux/aqa-tests/TKG/output_16676679384301/serviceability_jvmti_j9_1/work
[2022-11-05T17:46:43.918Z] Error: Some tests failed or other problems occurred.
[2022-11-05T17:46:43.918Z] 
[2022-11-05T17:46:43.918Z] serviceability_jvmti_j9_1_FAILED

50x internal grinder - all failed

@babsingh
Copy link
Contributor

babsingh commented Nov 10, 2022

The test fails for a platform thread. This is not related to Project Loom, and does not need to be addressed for the Java 19 release.

The thread is correctly suspended. But, the JVMTI_THREAD_STATE_IN_NATIVE flag is set in the thread-state, which causes the test to fail. The failure only occurs on Linux s390. As per the rules in JVMTI GetThreadState's spec, JVMTI_THREAD_STATE_IN_NATIVE is allowed to be set along with JVMTI_THREAD_STATE_SUSPENDED.

So, the test needs to perform a check similar to OMR_ARE_ALL_BITS_SET instead of an equality check (state != expectedState) to resolve this failure.

[2022-11-05T17:46:43.918Z] Expected platform thread state: 100005 got: 500005

Expected:
- 0x000001: JVMTI_THREAD_STATE_ALIVE
- 0x000004: JVMTI_THREAD_STATE_RUNNABLE
- 0x100000: JVMTI_THREAD_STATE_SUSPENDED

Got:
- 0x000001: JVMTI_THREAD_STATE_ALIVE
- 0x000004: JVMTI_THREAD_STATE_RUNNABLE
- 0x100000: JVMTI_THREAD_STATE_SUSPENDED
- 0x400000: JVMTI_THREAD_STATE_IN_NATIVE

Macro Definitions

#define JVMTI_THREAD_STATE_ALIVE 0x00000001
#define JVMTI_THREAD_STATE_TERMINATED 0x00000002
#define JVMTI_THREAD_STATE_RUNNABLE 0x00000004
#define JVMTI_THREAD_STATE_WAITING_INDEFINITELY 0x00000010
#define JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT 0x00000020
#define JVMTI_THREAD_STATE_SLEEPING 0x00000040
#define JVMTI_THREAD_STATE_WAITING 0x00000080
#define JVMTI_THREAD_STATE_IN_OBJECT_WAIT 0x00000100
#define JVMTI_THREAD_STATE_PARKED 0x00000200
#define JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 0x00000400
#define JVMTI_THREAD_STATE_SUSPENDED 0x00100000
#define JVMTI_THREAD_STATE_INTERRUPTED 0x00200000
#define JVMTI_THREAD_STATE_IN_NATIVE 0x00400000
#define JVMTI_THREAD_STATE_VENDOR_1 0x10000000
#define JVMTI_THREAD_STATE_VENDOR_2 0x20000000
#define JVMTI_THREAD_STATE_VENDOR_3 0x40000000

babsingh added a commit to babsingh/openj9-openjdk-jdk19 that referenced this issue Nov 10, 2022
See eclipse-openj9/openj9#16276.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/openj9-openjdk-jdk that referenced this issue Nov 11, 2022
See eclipse-openj9/openj9#16276.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@keithc-ca
Copy link
Contributor

I don't agree with the solution to this. The quoted document says:

More than one of
JVMTI_THREAD_STATE_SUSPENDED
JVMTI_THREAD_STATE_INTERRUPTED
JVMTI_THREAD_STATE_IN_NATIVE
can be set, but if any is set, JVMTI_THREAD_STATE_ALIVE is set.

This says to me that JVMTI_THREAD_STATE_IN_NATIVE is not permitted in combination with JVMTI_THREAD_STATE_SUSPENDED.

@keithc-ca keithc-ca reopened this Nov 23, 2022
@tajila
Copy link
Contributor

tajila commented Nov 23, 2022

This says to me that JVMTI_THREAD_STATE_IN_NATIVE is not permitted in combination with JVMTI_THREAD_STATE_SUSPENDED.

Can you please elaborate? "More than one of..." implies that both JVMTI_THREAD_STATE_IN_NATIVE and JVMTI_THREAD_STATE_SUSPENDED can be set simultaneously.

@keithc-ca
Copy link
Contributor

Perhaps I read too quickly (or misread that document). Either I assumed that ALIVE was incompatible with SUSPENDED or I misread 'more than one of' as 'not more than one of' (like earlier sections). I no longer see a problem with the combination of NATIVE and SUSPENDED.

On the other hand, the test was excessively relaxed, by ignoring all bits other than the expected ones: now situations where more bits are set than legally should be will not (but should) fail.

@tajila
Copy link
Contributor

tajila commented Dec 5, 2022

@babsingh can you address Keiths comment

@babsingh
Copy link
Contributor

babsingh commented Dec 5, 2022

Yes, planning to create a fix by EOD.

babsingh added a commit to babsingh/openj9-openjdk-jdk19 that referenced this issue Dec 5, 2022
Fixes: eclipse-openj9/openj9#16276

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/openj9-openjdk-jdk that referenced this issue Dec 5, 2022
Fixes: eclipse-openj9/openj9#16276

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/openj9-openjdk-jdk that referenced this issue Dec 6, 2022
Fixes: eclipse-openj9/openj9#16276

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/openj9-openjdk-jdk19 that referenced this issue Dec 6, 2022
Fixes: eclipse-openj9/openj9#16276

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/openj9-openjdk-jdk19 that referenced this issue Dec 6, 2022
Fixes: eclipse-openj9/openj9#16276

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment