The issue is a large in the 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.

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 event to the debug agent 
results in this timestamp API being called, so the fix is to massage 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).

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

Commit messages:
 - fix whitespace issue
 - fix some newline issues
 - enable new fix
 - remove old fix
 - trigger fewer methodentry/exit events

Changes: https://git.openjdk.org/jdk/pull/31264/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31264&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8375076
  Stats: 36 lines in 6 files changed: 24 ins; 3 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/31264.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31264/head:pull/31264

PR: https://git.openjdk.org/jdk/pull/31264

Reply via email to