On Sat, 23 May 2026 00:16:34 GMT, Chris Plummer <[email protected]> wrote:

> The issue is a large number of method calls and exits that are done in 
> library initialization code while the test has enabled MethodExit and/or 
> MethodEntry events. These events are being be generated during the debuggee 
> System.exit() call, sometimes resulting in the test timing out during exit.
> 
> There are 3 tests that appear to have timedout as a result of this at some 
> point, and I found 1 other that is at risk.
> 
>      vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java. 
> <--- hasn't failed yet
>      vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001/TestDescription.java
>      
> vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003/TestDescription.java
>      
> vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java
> 
> The timeouts only happens on Windows hosts where the API to get a timestamp 
> is slow. The delivery of a JVMTI MethodEntry or Exit events to the debug 
> agent results in this timestamp API being called. The fix is to modify the 
> tests to reduce the number of JVMTI events, either by disabling the events 
> before doing the System.exit() or triggering the loading and initialization 
> of the classes early before the events are enabled. The latter is chosen when 
> it is difficult to find a good time to disable the events.
> 
> Note that these MethodEntry/Exits events for the most part are all filtered 
> out by the debug agent because the test only wants them from certain test 
> classes. Valhalla made the issue worse by triggering more class loading and 
> initialization while the events are enabled, and the changes in valhalla 
> responsible for this have since been integrated into mainline with 
> [JDK-8377070](https://bugs.openjdk.org/browse/JDK-8377070), causing at least 
> the popframes001 failure to start appearing there also.
> 
> Tested by running all the tests 100s of times on Windows, and also tested 
> these changes in the valhalla repo.
> Also ran all svc tier1, tier2, and tier5 tests.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Disabling events when done seems a good general approach.

The explicit pre-loading/init seems an unfortunate necessity as per the other 
PR.

Thanks

test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java 
line 42:

> 40:     public static void main(String argv[]) {
> 41:         // The following will cause intialization of a bunch of classes 
> before we
> 42:         // enable MethoEntry/Exit events, which would otherwise result in 
> long test runs.

Suggestion:

        // enable MethodEntry/Exit events, which would otherwise result in long 
test runs.

-------------

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31264#pullrequestreview-4354447704
PR Review Comment: https://git.openjdk.org/jdk/pull/31264#discussion_r3296277856

Reply via email to