Skip to content

Conversation

@jaikiran
Copy link
Member

@jaikiran jaikiran commented Feb 3, 2025

Can I please get a review of this change which backs out the commit that was introduced for https://bugs.openjdk.org/browse/JDK-8333893?

The comment in the PR review of that issue #19626 (comment) explains what the issue is with the change that was integrated. Furthermore, one part of that original change introduced a few internal methods. These internal methods were then used in few other places within the JDK through https://bugs.openjdk.org/browse/JDK-8343650. As a result, this backout PR also reverts the change that was done in JDK-8343650.

The backout was done as follows, using git revert against the 2 relevant commits:

git revert 74ae3c688b37e693e20eb4e17c631897c5464400
git revert 5890d9438bbde88b89070052926a2eafe13d7b42

The revert of 5890d9438bbde88b89070052926a2eafe13d7b42 wasn't clean and I had to resolve a trivial conflict in StringLatin1.java.

tier1, tier2 and tier3 testing is currently in progress with this change. Once this is integrated into mainline, a corresponding backport will be done to jdk24 branch with the requisite approvals.


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

Issues

  • JDK-8349183: [BACKOUT] Optimization for StringBuilder append boolean & null (Sub-task - P2)
  • JDK-8349239: [BACKOUT] Reuse StringLatin1::putCharsAt and StringUTF16::putCharsAt (Bug - P4)

Reviewers

Reviewers without OpenJDK IDs

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23420

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 3, 2025

👋 Welcome back jpai! 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 Feb 3, 2025

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

8349183: [BACKOUT] Optimization for StringBuilder append boolean & null
8349239: [BACKOUT] Reuse StringLatin1::putCharsAt and StringUTF16::putCharsAt

Reviewed-by: redestad, liach

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 1 new commit pushed to the master branch:

  • bb837d2: 8342775: [Graal] java/util/concurrent/locks/Lock/OOMEInAQS.java fails OOME thrown from the UncaughtExceptionHandler

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Feb 3, 2025
@openjdk
Copy link

openjdk bot commented Feb 3, 2025

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

  • core-libs
  • hotspot-compiler

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.

@mlbridge
Copy link

mlbridge bot commented Feb 3, 2025

Webrevs

@openjdk openjdk bot removed the rfr Pull request is ready for review label Feb 3, 2025
@jaikiran jaikiran marked this pull request as ready for review February 3, 2025 16:32
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 3, 2025
@wenshao
Copy link
Contributor

wenshao commented Feb 3, 2025

This concurrency problem also exists in the UTF16 scenario, so why only change to Latin1 here?

@jaikiran
Copy link
Member Author

jaikiran commented Feb 3, 2025

This concurrency problem also exists in the UTF16 scenario, so why only change to Latin1 here?

Do you mean there are additional commits that have been done in the JDK which introduce a similar issue related to array writes beyond their limit that need to be backed out?

@cl4es
Copy link
Member

cl4es commented Feb 3, 2025

@wenshao this re-instates the checkBoundsBeginEnd(i, end, value); in the UTF16 case that was removed by the issue being backed out, so we get back to a state where we have appropriate bounds checks on all array accesses.

An alternative to this backout would be to add checkBoundsBeginEnd(i, end, value); to all the putCharsAt methods, though it's unclear if that would undo the performance advantage. Better then to backout and - if possible - redo with a closer examination of the performance with a safer construct.

putChar(val, index + 4, c5);
public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
int end = i + 4;
checkBoundsBeginEnd(i, end, value);
Copy link
Member

Choose a reason for hiding this comment

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

We have this explicit check for null and true, false has another bound check. This backout version should be safe.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 3, 2025
Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

Also for append(char): it uses putCharSB which does a check and calls unchecked putChar. putCharsAt is always checked.

@jaikiran
Copy link
Member Author

jaikiran commented Feb 3, 2025

Thank you Claes and Chen for the reviews. tier1, tier2 and tier3 testing is nearing completion without any failures. Could one of you approve that it's OK to integrate this trivial backout without waiting for 24 hours (the review process allows it https://openjdk.org/guide/#trivial-changes)? I will be integrating this as soon as the tier testing completes.

@wenshao
Copy link
Contributor

wenshao commented Feb 3, 2025

Can you wait for me for a while? I am looking for other solutions that do not require a fallback.

@jaikiran
Copy link
Member Author

jaikiran commented Feb 3, 2025

Can you wait for me for a while? I am looking for other solutions that do not require a fallback.

The updated fix/change (if any) doesn't have to be rushed and you can take longer to work on it with additional help and reviews from others.

Once this backout is integrated into mainline, it will be backported to jdk24 (which is to be released in a few days). The risk of waiting for an additional/different fix is higher compared to a backout. So we intend to go ahead with the backout.

@wenshao
Copy link
Contributor

wenshao commented Feb 3, 2025

#23423
I submitted another PR where I reproduced the issue locally and this PR fixed the issue.

@JesperIRL
Copy link
Member

Thank you Claes and Chen for the reviews. tier1, tier2 and tier3 testing is nearing completion without any failures. Could one of you approve that it's OK to integrate this trivial backout without waiting for 24 hours (the review process allows it https://openjdk.org/guide/#trivial-changes)? I will be integrating this as soon as the tier testing completes.

A backout is always considered a trivial change. See https://openjdk.org/guide/#backing-out-a-change

@jaikiran
Copy link
Member Author

jaikiran commented Feb 3, 2025

/issue add JDK-8349239

@openjdk
Copy link

openjdk bot commented Feb 3, 2025

@jaikiran
Adding additional issue to issue list: 8349239: [BACKOUT] Reuse StringLatin1::putCharsAt and StringUTF16::putCharsAt.

@wenshao
Copy link
Contributor

wenshao commented Feb 3, 2025

Don't rush to roll back, the current rollback solution still has problems

@jaikiran
Copy link
Member Author

jaikiran commented Feb 3, 2025

Thank you all for the help on this one.

/integrate

@openjdk
Copy link

openjdk bot commented Feb 3, 2025

Going to push as commit 618c5eb.
Since your change was applied there has been 1 commit pushed to the master branch:

  • bb837d2: 8342775: [Graal] java/util/concurrent/locks/Lock/OOMEInAQS.java fails OOME thrown from the UncaughtExceptionHandler

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 3, 2025

@jaikiran Pushed as commit 618c5eb.

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

@wenshao
Copy link
Contributor

wenshao commented Feb 3, 2025

The problem still exists, we need to complete another PR #23427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

6 participants