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

8347274: Gatherers.mapConcurrent exhibits undesired behavior under variable delays, interruption, and finishing #22999

Closed
wants to merge 2 commits into from

Conversation

viktorklang-ora
Copy link
Contributor

@viktorklang-ora viktorklang-ora commented Jan 9, 2025

The following patch updates Gatherers.mapConcurrent to limit work-in-progress (on-going and completed-unpushed) to the maxConcurrency so that head-of-line blocking does not cause completed-unpushed work to grow unbounded.

This also simplifies interruption handling to ignore-and-restore, which needs to be done on a per-element-basis as the calling thread can change between invocations of the integrator, as well as the finisher, so restoring it on finish is not possible (and won't happen if there's an exception thrown during integration anyway).

Furthermore, logic has been added to reduce the risk of any spawned virtual threads surviving the processing of the stream.


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-8347274: Gatherers.mapConcurrent exhibits undesired behavior under variable delays, interruption, and finishing (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22999

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 9, 2025

👋 Welcome back vklang! 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 Jan 9, 2025

@viktorklang-ora 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:

8347274: Gatherers.mapConcurrent exhibits undesired behavior under variable delays, interruption, and finishing

Reviewed-by: alanb

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

  • 57af52c: 8346581: JRadioButton/ButtonGroupFocusTest.java fails in CI on Linux
  • 1f45797: 8347124: Clean tests with --enable-linkable-runtime
  • 5e92a4c: 8347267: [macOS]: UnixOperatingSystem.c:67:40: runtime error: division by zero
  • 55c6904: 8331717: C2: Crash with SIGFPE Because Loop Predication Wrongly Hoists Division Requiring Zero Check
  • 1a0fe49: 8347256: Epsilon: Demote heap size and AlwaysPreTouch warnings to info level
  • 8b07617: 8347345: Remove redundant test policy file from ModelMBeanInfoSupport directory
  • f6492aa: 8347279: Problemlist TestEvilSyncBug.java#generational
  • 0210a63: 8347379: Problem list failed tests after JDK-8321413
  • a9351df: 8346787: Fix two C2 IR matching tests for RISC-V
  • 89ee1a5: 8343978: Update the default value of CodeEntryAlignment for Ampere-1A and 1B
  • ... and 37 more: https://git.openjdk.org/jdk/compare/ae3fc464563ad1ba59883ccf60d235b42f5ad7fa...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 rfr Pull request is ready for review label Jan 9, 2025
@openjdk
Copy link

openjdk bot commented Jan 9, 2025

@viktorklang-ora The following label will be automatically applied to this pull request:

  • core-libs

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

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jan 9, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 9, 2025

Webrevs

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

I looked at a few early iterations of this as the PR was being created so I think in a good place.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 9, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 9, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 10, 2025
@viktorklang-ora
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 13, 2025

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

  • 82e2a79: 8347006: LoadRangeNode floats above array guard in arraycopy intrinsic
  • 85ed78c: 8345185: Update jpackage to not include service bindings by default
  • 3b9732e: 8345471: Clean up compiler/intrinsics/sha/cli tests
  • ed0b555: 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor
  • b37f123: 8347407: [BACKOUT] C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
  • 1f7925c: 8347270: Remove unix_getParentPidAndTimings, unix_getChildren and unix_getCmdlineAndUserInfo
  • 9fafd63: 8346828: javax/swing/JScrollBar/4865918/bug4865918.java still fails in CI
  • f04a642: 8346717: serviceability/dcmd/vm/SystemDumpMapTest.java failing on Windows with "Stack base not yet set for thread id"
  • 3145278: 8346727: JvmtiVTMSTransitionDisabler deadlock
  • 761774a: 8346143: add ClearAllFramePops function to speedup debugger single stepping in some cases
  • ... and 60 more: https://git.openjdk.org/jdk/compare/ae3fc464563ad1ba59883ccf60d235b42f5ad7fa...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 13, 2025

@viktorklang-ora Pushed as commit 450636a.

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

@viktorklang-ora
Copy link
Contributor Author

/backport :jdk24

@openjdk
Copy link

openjdk bot commented Jan 14, 2025

@viktorklang-ora Could not automatically backport 450636ae to openjdk/jdk due to conflicts in the following files:

  • test/jdk/java/util/stream/GatherersMapConcurrentTest.java

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk.git jdk24:jdk24

# Check out the target branch and create your own branch to backport
$ git checkout jdk24
$ git checkout -b backport-viktorklang-ora-450636ae-jdk24

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git 450636ae28b84ded083b6861c6cba85fbf87e16e

# Backport the commit
$ git cherry-pick --no-commit 450636ae28b84ded083b6861c6cba85fbf87e16e
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 450636ae28b84ded083b6861c6cba85fbf87e16e'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Backport 450636ae28b84ded083b6861c6cba85fbf87e16e.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 450636ae from the openjdk/jdk repository.

The commit being backported was authored by Viktor Klang on 13 Jan 2025 and was reviewed by Alan Bateman.

Thanks!

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
Development

Successfully merging this pull request may close these issues.

2 participants