Skip to content

8266130: convert Thread-SMR stress tests from counter based to time based #4237

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

Closed
wants to merge 5 commits into from

Conversation

dcubed-ojdk
Copy link
Member

@dcubed-ojdk dcubed-ojdk commented May 28, 2021

The Thread-SMR project added counter based tests for various APIs.
See "JDK-8167108 inconsistent handling of SR_lock can lead to crashes".

Time based tests are more appropriate for stress kits so I'm
updating the counter based tests to be time based instead.

Two of the updated tests have shaken out failures that are tracked by:

JDK-8264605 vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/TestDescription.java failed with "agent_tools.cpp, 471: (foundThread = (jthread) jni_env->NewGlobalRef(foundThread)) != NULL"

JDK-8266593 vmTestbase/nsk/jvmti/PopFrame/popframe011 fails with "assert(java_thread == _state->get_thread()) failed: Must be"

These updated tests are tested via Mach5 Tier[134567].
They have also been test by my Stress Kit runs for jdk-17+2[0-5].


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8266130: convert Thread-SMR stress tests from counter based to time based

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4237/head:pull/4237
$ git checkout pull/4237

Update a local copy of the PR:
$ git checkout pull/4237
$ git pull https://git.openjdk.java.net/jdk pull/4237/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4237

View PR using the GUI difftool:
$ git pr show -t 4237

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4237.diff

@dcubed-ojdk
Copy link
Member Author

/label add hotspot-runtime
/label add serviceability

@bridgekeeper
Copy link

bridgekeeper bot commented May 28, 2021

👋 Welcome back dcubed! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label May 28, 2021
@openjdk
Copy link

openjdk bot commented May 28, 2021

@dcubed-ojdk
The hotspot-runtime label was successfully added.

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label May 28, 2021
@openjdk
Copy link

openjdk bot commented May 28, 2021

@dcubed-ojdk
The serviceability label was successfully added.

@dcubed-ojdk dcubed-ojdk changed the title 8266130: covert Thread-SMR stress tests from counter based to time based 8266130: convert Thread-SMR stress tests from counter based to time based May 28, 2021
@dcubed-ojdk dcubed-ojdk marked this pull request as ready for review May 28, 2021 21:50
@openjdk openjdk bot added the rfr Pull request is ready for review label May 28, 2021
@mlbridge
Copy link

mlbridge bot commented May 28, 2021

Webrevs

@dcubed-ojdk
Copy link
Member Author

Here are my Mach5 Tier[1-7] results:

Mach5 Tier1:

  • no failures
  • 25 runs of the updated tests in Tier1

Mach5 Tier2:

  • 1 known, unrelated failure
  • The updated tests don't run in Tier2.

Mach5 Tier3:

  • 5 known, unrelated test failures
  • 70 runs of the updated tests

Mach5 Tier4:

  • 17 runs of the updated tests
  • 2 known, unrelated test failures

Mach5 Tier5:

  • 56 runs of the updated tests
  • 1 known, unrelated failure, 3 failures of the updated tests linked to the known bugs

Mach5 Tier6:

  • 122 runs of the updated tests
  • 2 failures of the updated tests, linked to the known bugs

Mach5 Tier7:

  • 151 runs of the updated tests
  • 1 failure of the updated tests, linked to the known bug

Because of the failures in the upper tiers, when this PR is integrated I will be ProblemListing:

vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/TestDescription.java 8264605
vmTestbase/nsk/jvmti/PopFrame/popframe011/TestDescription.java 8266593

The suspendthrd003/8264605 failure had been seen one time in the CI on 2021.04.01
(April Fools Day!) and is now much more reproducible with the updated version. The
popframe011/8266593 failure had never been seen before being updated.

@dcubed-ojdk
Copy link
Member Author

Ping! Any takers?
@dholmes-ora and @plummercj - You both reviewed the related test work done in:
JDK-8265153 add time based test for ThreadMXBean.getThreadInfo() and ThreadInfo.getLockOwnerName()
Any chance you have the cycles for these updates this week?

@plummercj
Copy link
Contributor

@dholmes-ora and @plummercj - You both reviewed the related test work done in:
JDK-8265153 add time based test for ThreadMXBean.getThreadInfo() and ThreadInfo.getLockOwnerName()
Any chance you have the cycles for these updates this week?

Yes. Hopefully in the next day or two.

Comment on lines +77 to +82
thread.startSyncObj.await();
// Tell the worker thread to race to the exit and the
// Thread.interrupt() calls will come in during thread exit.
thread.exitSyncObj.countDown();
while (true) {
thread.interrupt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to make sure I correctly understand the intent here. You call countDown() to unblock the thread's run() method, and then immediately interrupt the thread to create a race between the thread doing a normal exit and the thread being interrupted before or as it exits.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. The intention is to stress the Thread.interrupt() calls
on the exiting thread.

// Thread.stop() calls will come in during thread exit.
thread.exitSyncObj.countDown();
while (true) {
thread.stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the main() method of these 6 or so thread tests are identical except for the one Thread API you call at this location. Have you considered refactoring so there is only one copy of all the common code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. It would be harder to use one of these tests in a standalone
fashion outside of JTREG runs if it depended on another .java file.


System.out.println("Case 2: java.lang.Thread.interrupt()");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was Case 2 removed because it is covered by runtime/Thread/InterruptAtExit.java

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seemed like duplicated coverage to me.

Comment on lines -101 to -102
* Using printf() instead of NSK_DISPLAY1() in this loop
* in order to slow down the rate of SuspendThread() calls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the reason for wanting to slow down the rate, nor your reason for removing it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't remember why I did that when I wrote the test so
I removed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to allow the resume to get the thread back into real code before the next suspend hits?

@openjdk
Copy link

openjdk bot commented Jun 8, 2021

@dcubed-ojdk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8266130: convert Thread-SMR stress tests from counter based to time based

Reviewed-by: cjplummer, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 235 new commits pushed to the master branch:

  • f4b3170: 8268428: Test java/foreign/TestResourceScope.java fails: expected [M] but found [N]
  • 6b6ff53: 8268543: some runtime/verifier tests should be run in driver mode
  • 0924382: 8266766: Arrays of types that cannot be an annotation member do not yield exceptions
  • d43c8a7: 8268124: Update java.lang to use switch expressions
  • a187fcc: 8238197: JFR: Rework setting and getting EventHandler
  • f770f77: 8268390: G1 concurrent gc upgrade to full gc not working
  • e0c0b13: 8268534: some serviceability/jvmti tests should be run in driver mode
  • 92f0b6d: 8268532: several serviceability/attach tests should be run in driver mode
  • 964118f: 8268538: mark hotspot serviceability/logging tests which ignore external VM flags
  • 05090fc: 8268536: mark hotspot serviceability/dcmd tests which ignore external VM flags
  • ... and 225 more: https://git.openjdk.java.net/jdk/compare/8a31c07598cd5ea1305a9706d80b0251fd3a1e6d...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 8, 2021
@dcubed-ojdk
Copy link
Member Author

@plummercj - Thanks for the review!

Any other takers out there?

…cription.java until 8264605 is fixed and vmTestbase/nsk/jvmti/PopFrame/popframe011/TestDescription.java until 8266593 is fixed.
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Dan,

This all seems okay. Sorry it took so long to get to it.

Note: All the usage() calls are indented incorrectly.

Thanks,
David

Comment on lines -101 to -102
* Using printf() instead of NSK_DISPLAY1() in this loop
* in order to slow down the rate of SuspendThread() calls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to allow the resume to get the thread back into real code before the next suspend hits?

@dcubed-ojdk
Copy link
Member Author

@dholmes-ora - Thanks for the review! I fixed the indent on the usage() calls.

@dcubed-ojdk
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Jun 10, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 10, 2021
@openjdk
Copy link

openjdk bot commented Jun 10, 2021

@dcubed-ojdk Since your change was applied there have been 236 commits pushed to the master branch:

  • 6c552a7: 8268544: some runtime/sealedClasses tests should be run in driver mode
  • f4b3170: 8268428: Test java/foreign/TestResourceScope.java fails: expected [M] but found [N]
  • 6b6ff53: 8268543: some runtime/verifier tests should be run in driver mode
  • 0924382: 8266766: Arrays of types that cannot be an annotation member do not yield exceptions
  • d43c8a7: 8268124: Update java.lang to use switch expressions
  • a187fcc: 8238197: JFR: Rework setting and getting EventHandler
  • f770f77: 8268390: G1 concurrent gc upgrade to full gc not working
  • e0c0b13: 8268534: some serviceability/jvmti tests should be run in driver mode
  • 92f0b6d: 8268532: several serviceability/attach tests should be run in driver mode
  • 964118f: 8268538: mark hotspot serviceability/logging tests which ignore external VM flags
  • ... and 226 more: https://git.openjdk.java.net/jdk/compare/8a31c07598cd5ea1305a9706d80b0251fd3a1e6d...master

Your commit was automatically rebased without conflicts.

Pushed as commit f677163.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@dcubed-ojdk dcubed-ojdk deleted the JDK-8266130 branch June 10, 2021 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants