Stabilize TestSharedCloseJvmti by avoiding latch park#22
Stabilize TestSharedCloseJvmti by avoiding latch park#22babsingh wants to merge 1 commit intoibmruntimes:openj9from
Conversation
|
I don't see how this helps. It is the main thread that calls |
|
There is implicit code not visible in the testcase: This expands to: The main thread is blocked inside |
It is fixed by the below PRs. Extension Repo PRs (Test fix): - JDK-next: ibmruntimes/openj9-openjdk-jdk#1174 - JDK26: ibmruntimes/openj9-openjdk-jdk26#22 OpenJ9 PR (VM/JIT fix): eclipse-openj9/openj9#23367 Related: eclipse-openj9/openj9#22934 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
TestSharedCloseJvmti.java is fixed by the below PRs. Extension Repo PRs (Test fix): - JDK-next: ibmruntimes/openj9-openjdk-jdk#1174 - JDK26: ibmruntimes/openj9-openjdk-jdk26#22 OpenJ9 PR (VM/JIT fix): eclipse-openj9/openj9#23367 Related: eclipse-openj9/openj9#22934 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
test/jdk/java/foreign/sharedclosejvmti/TestSharedCloseJvmti.java
Outdated
Show resolved
Hide resolved
This is the issue that must be fixed. The closing threads must always make progress. |
|
The test has been updated while preserving its original intent.
This is not a requirement for the API.
Also not an API requirement. It would be a robustness improvement, but would effectively require a different close protocol (handshake-style) rather than the current flag + polling model, and may still have gaps under certain JVMTI behavior. @gacholio @tajila, thoughts on value+feasibility of this in the long run? This is infeasible for JDK26. |
|
Not entirely sure what you're asking - you say close must block if other threads are in the scope. Changing the handshake method will not change this. |
|
Is this close a public API or only used internally by the implementation? |
|
It is public API; see |
Update TestSharedCloseJvmti to remove CountDownLatch.await() from the JVMTI re-entrant callback path and replace it with a spin wait on a volatile flag. The previous test parked the Trigger thread while executing re-entrantly from a JVMTI MethodExit callback during a scoped access. On OpenJ9, shared scope close relies on async polling (javaCheckAsyncMessages) for close-scope acknowledgement. Parking the thread in this path can prevent polling and cause intermittent hangs. The test intent is to exercise additional stack frames during scoped access, not thread parking inside JVMTI callbacks. Using a spin loop keeps the thread runnable and preserves the stack-shape stress scenario while avoiding the hang. Scoped close/exception handling differs across JVMs. The RI uses a per-thread handshake and deopt-based approach, while OpenJ9 uses a flag-and-polling model. This change keeps the test portable across both. Remove the unused TARGET_LATCH and add a volatile CLOSED flag for cross-thread visibility. Related: eclipse-openj9/openj9#22934 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
|
I have addressed @gacholio's feedback on the comment. At this point, I do not see a clear path to enforcing a strict Given the JDK26 release timeline in the first half of Mar 26, I would appreciate any direction on how best to move this PR forward. |
|
Weakening the test is not the solution. Other than the use of JVMTI to forcibly arrange that one thread is actively using an Perhaps the "close coordination" in the VM is deficient. If threads affected by the closure of an arena are live, they should respond in a timely manner to the asynchronous event. If they are blocked/parked (e.g. within |
Update TestSharedCloseJvmti to remove CountDownLatch.await() from the
JVMTI re-entrant callback path and replace it with a spin wait on a
volatile flag.
The previous test parked the Trigger thread while executing re-entrantly
from a JVMTI MethodExit callback during a scoped access. On OpenJ9,
shared scope close relies on async polling (javaCheckAsyncMessages) for
close-scope acknowledgement. Parking the thread in this path can prevent
polling and cause intermittent hangs.
The test intent is to exercise additional stack frames during scoped
access, not thread parking inside JVMTI callbacks. Using a spin loop
keeps the thread runnable and preserves the stack-shape stress scenario
while avoiding the hang.
Scoped close/exception handling differs across JVMs. The RI uses a
per-thread handshake and deopt-based approach, while OpenJ9 uses a
flag-and-polling model. This change keeps the test portable across both.
Remove the unused TARGET_LATCH and add a volatile CLOSED flag for
cross-thread visibility.
Related: eclipse-openj9/openj9#22934