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

8320707: Virtual thread test updates #17136

Closed
wants to merge 4 commits into from

Conversation

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Dec 16, 2023

A lot of test changes have accumulated in the loom repo, this includes both new tests and updates to existing tests. Some of these updates can be brought to the main line. This update brings over:

  • The existing tests for pinning use synchronized blocks. In preparation for changes to allow carrier thread be released when a virtual thread parks holding a monitor or blocks on monitorenter, these tests are changed to pin by having a native frame on the stack. This part includes test infrastructure to make it easy to add more tests that do operations while pinned. The tests still test what they were originally created to test of course.

  • The test for the JFR jdk.VirtualThreadPinned event is refactored to allow for additional cases where the event may be reported.

  • ThreadAPI is expanded to cover test for uncaught exception handling.

  • GetStackTraceWhenRunnable is refactored to not use a Selector, otherwise this test will be invalidated when blocking selection operations release the carrier.

  • StressStackOverflow is dialed down to run for 1m instead of 2mins.

  • The use of CountDownLatch in a number of tests that poll thread state has been dropped to keep the tests as simple as possible.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8320707: Virtual thread test updates (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17136/head:pull/17136
$ git checkout pull/17136

Update a local copy of the PR:
$ git checkout pull/17136
$ git pull https://git.openjdk.org/jdk.git pull/17136/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17136

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17136.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 16, 2023

👋 Welcome back alanb! 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
Copy link

openjdk bot commented Dec 16, 2023

@AlanBateman The following labels will be automatically applied to this pull request:

  • core-libs
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Dec 16, 2023
@AlanBateman AlanBateman marked this pull request as ready for review December 17, 2023 07:33
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 17, 2023
@mlbridge
Copy link

mlbridge bot commented Dec 17, 2023

Webrevs

@plummercj
Copy link
Contributor

Can you explain your motivation for using AtomicBoolean with a polling loop rather than CountDownLatch(1)? I'm working on a test where I just added a CountDownLatch(1) and am wondering if I should do the same, but I'm not sure if there is something about these tests that is motivating the change.

@AlanBateman
Copy link
Contributor Author

AlanBateman commented Dec 19, 2023

I'm working on a test where I just added a CountDownLatch(1) and am wondering if I should do the same, but I'm not sure if there is something about these tests that is motivating the change.

CountDownLatch is great for many tests. It's not as powerful as a Phaser of course but good enough and usually easy to understand quickly what is going on. However, for tests that are testing thread state then you often want to have as few dependencies as possible. In the case of CountDownlatch, the await method may park. The countDown method may have to unpark waiters for for virtual threads it means potentially parking (to queue a task) when unparking, so temporary transitions that JVMTI has to be concerned with. The other thing is keeping tests simple/consistent, it can be hard to maintain tests where one test method coordinates with one approach, another test method does something different.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

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

Overall these changes look OK to me. I haven't paid much attention to the jvmti test change, but I've looked at others and they seem fine.
The StressStackOverflow test has its duration reduced by half which appears intentional and then there's a new test library helper class to allow pinning tasks in tests.

Just one question - doesn't the use of a new native code in the test library (the libVThreadPinner.c) require any build changes (I'm not too familiar with that part)?

@openjdk
Copy link

openjdk bot commented Jan 3, 2024

@AlanBateman 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:

8320707: Virtual thread test updates

Reviewed-by: jpai

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 25 new commits pushed to the master branch:

  • a8e4229: 8322783: prioritize /etc/os-release over /etc/SuSE-release in hs_err/info output
  • cbe329b: 8321713: Harmonize executeTestJvm with create[Limited]TestJavaProcessBuilder
  • 06dd735: 8322766: Micro bench SSLHandshake should use default algorithms
  • 9ab29f8: 8321718: ProcessTools.executeProcess calls waitFor before logging
  • ba426d6: 8322841: Parallel: Remove unused using-declaration in MutableNUMASpace
  • 18cdc90: 8322801: RISC-V: The riscv path of the debian sysroot had been changed
  • fcf8368: 8322248: Fix inconsistent wording in ElementFilter.typesIn
  • a678416: 8322805: Eliminate -Wparentheses warnings in x86 code
  • 122bc77: 8322758: Eliminate -Wparentheses warnings in C2 code
  • e9e694f: 8320275: assert(_chunk->bitmap().at(index)) failed: Bit not set at index
  • ... and 15 more: https://git.openjdk.org/jdk/compare/32d80e2caf6063b58128bd5f3dc87b276f3bd0cb...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 Jan 3, 2024
@AlanBateman
Copy link
Contributor Author

AlanBateman commented Jan 3, 2024

Just one question - doesn't the use of a new native code in the test library (the libVThreadPinner.c) require any build changes (I'm not too familiar with that part)?

Magnus did some work in the make files some time ago to build native libs in the test/lib tree.

Thanks for reviewing.

@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 3, 2024

Going to push as commit b67b71c.
Since your change was applied there have been 27 commits pushed to the master branch:

  • 7eb25ec: 8322853: Should use ConditionalMutexLocker in NativeHeapTrimmerThread::print_state
  • 539da24: 8322779: C1: Remove the unused counter 'totalInstructionNodes'
  • a8e4229: 8322783: prioritize /etc/os-release over /etc/SuSE-release in hs_err/info output
  • cbe329b: 8321713: Harmonize executeTestJvm with create[Limited]TestJavaProcessBuilder
  • 06dd735: 8322766: Micro bench SSLHandshake should use default algorithms
  • 9ab29f8: 8321718: ProcessTools.executeProcess calls waitFor before logging
  • ba426d6: 8322841: Parallel: Remove unused using-declaration in MutableNUMASpace
  • 18cdc90: 8322801: RISC-V: The riscv path of the debian sysroot had been changed
  • fcf8368: 8322248: Fix inconsistent wording in ElementFilter.typesIn
  • a678416: 8322805: Eliminate -Wparentheses warnings in x86 code
  • ... and 17 more: https://git.openjdk.org/jdk/compare/32d80e2caf6063b58128bd5f3dc87b276f3bd0cb...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 3, 2024
@openjdk openjdk bot closed this Jan 3, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 3, 2024
@openjdk
Copy link

openjdk bot commented Jan 3, 2024

@AlanBateman Pushed as commit b67b71c.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-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