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

8260010: UTF8ZipCoder not thread-safe since JDK-8243469 #2163

Closed
wants to merge 4 commits into from

Conversation

@cl4es
Copy link
Member

@cl4es cl4es commented Jan 20, 2021

This patch resolves a thread-safety issue where the singleton UTF8ZipCoder is erroneously using a shared CharsetDecoder when the fast-path fails. It needs to go via creating a new String like before JDK-8243469

This should resolve a rare issue when doing a lot of jar scanning in parallel on jar/zip files (with at least some non-ASCII entries), but I've not managed to create a test that reliably reproduce the issue.


Progress

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

Issue

  • JDK-8260010: UTF8ZipCoder not thread-safe since JDK-8243469

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2163/head:pull/2163
$ git checkout pull/2163

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jan 20, 2021

👋 Welcome back redestad! 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 rfr label Jan 20, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jan 20, 2021

@cl4es 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 label Jan 20, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jan 20, 2021

Webrevs

return normalizedHashDecode(h, a, off, end);
// Non-ASCII, fall back to decoding a String
String s = JLA.newStringUTF8NoRepl(a, end - len, end);
h = s.hashCode();

This comment has been minimized.

@eirbjo

eirbjo Jan 20, 2021
Contributor

Would it be possible to call normalizedHash(String name) here?

This comment has been minimized.

@cl4es

cl4es Jan 20, 2021
Author Member

Yes, updated. (The PR was supposed to be a draft until now since I was fixing up some testing issues with my first stab at this.)

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

I think the changes look OK.

@openjdk
Copy link

@openjdk openjdk bot commented Jan 20, 2021

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

8260010: UTF8ZipCoder not thread-safe since JDK-8243469

Reviewed-by: lancea

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

  • 8b95d95: 8256895: Add support for RFC 8954: Online Certificate Status Protocol (OCSP) Nonce Extension
  • 4f11ff3: 8259488: Shenandoah: Missing timing tracking for STW CLD root processing
  • 0785147: 8259949: x86 32-bit build fails when -fcf-protection is passed in the compiler flags
  • 5891509: 8259947: (fs) Optimize UnixPath.encode implementation
  • 69f90b5: 8259843: initialize dli_fname array before calling dll_address_to_library_name
  • 52ed2aa: 8259786: initialize last parameter of getpwuid_r
  • 70b5b31: 8257664: HTMLEditorKit: Wrong CSS relative font sizes
  • 0b01d69: 8260005: Shenandoah: Remove unused AlwaysTrueClosure in ShenandoahConcurrentRootScanner::roots_do()
  • 0529480: 8259867: Move encoding checks into ZipCoder
  • 7c32ffe: 8258383: vmTestbase/gc/g1/unloading/tests/unloading_compilation_level[1,2,3] time out without TieredCompilation
  • ... and 3 more: https://git.openjdk.java.net/jdk/compare/a37cd5a3133d7c66942919655d977912491d5b8c...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 label Jan 20, 2021
@cl4es
Copy link
Member Author

@cl4es cl4es commented Jan 20, 2021

/integrate

@openjdk openjdk bot closed this Jan 20, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jan 20, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jan 20, 2021

@cl4es Since your change was applied there have been 13 commits pushed to the master branch:

  • 8b95d95: 8256895: Add support for RFC 8954: Online Certificate Status Protocol (OCSP) Nonce Extension
  • 4f11ff3: 8259488: Shenandoah: Missing timing tracking for STW CLD root processing
  • 0785147: 8259949: x86 32-bit build fails when -fcf-protection is passed in the compiler flags
  • 5891509: 8259947: (fs) Optimize UnixPath.encode implementation
  • 69f90b5: 8259843: initialize dli_fname array before calling dll_address_to_library_name
  • 52ed2aa: 8259786: initialize last parameter of getpwuid_r
  • 70b5b31: 8257664: HTMLEditorKit: Wrong CSS relative font sizes
  • 0b01d69: 8260005: Shenandoah: Remove unused AlwaysTrueClosure in ShenandoahConcurrentRootScanner::roots_do()
  • 0529480: 8259867: Move encoding checks into ZipCoder
  • 7c32ffe: 8258383: vmTestbase/gc/g1/unloading/tests/unloading_compilation_level[1,2,3] time out without TieredCompilation
  • ... and 3 more: https://git.openjdk.java.net/jdk/compare/a37cd5a3133d7c66942919655d977912491d5b8c...master

Your commit was automatically rebased without conflicts.

Pushed as commit 1f47de5.

💡 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
3 participants