-
Notifications
You must be signed in to change notification settings - Fork 147
8347712: IllegalStateException on multithreaded ZipFile access with non-UTF8 charset #1949
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
base: master
Are you sure you want to change the base?
Conversation
…on-UTF8 charset 8355975: ZipFile uses incorrect Charset if another instance for the same ZIP file was constructed with a different Charset Co-authored-by: Eirik Bjørsnøs <eirbjo@openjdk.org> Reviewed-by: eirbjo, lancea, redestad, alanb
|
👋 Welcome back jkratochvil! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issues from the original commit. |
Webrevs
|
|
|
|
/approval request There is needed a backport for 21u to fix ZIP files handling. It is not a clean backport, last commit resolves the conflicts. |
|
@jankratochvil |
|
Hi @jankratochvil |
|
@jankratochvil This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a |
|
Hi @jankratochvil |
This is an insufficient comment. Not explaining when the issue occurs, how likely it is, what you assess the risk of this change is and how you ensured this doesn't cause regressions when ported 4 releases back. It's a fresh change in JDK 25 to really evaluate its impact. This needs a really convincing argument to warrant the fix be backported. |
|
@jankratochvil This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a |
|
[edited] a mistaken comment: Besides other mentioned issues this backport is primarily blocked by CSR: https://bugs.openjdk.org/browse/JDK-8367128 |
How is this backport for ZipFile relevant for an ICC_Profile (AWT) CSR or vice versa? |
Sorry my mistake, the CSR was for an unrelated backport. |
|
The problem does not happen for UTF8 ZIPs as ZipCoder contains its specialization UTF8ZipCoder which is stateless so it can be shared across threads. For non-UTF8 ZIPs: The problem occured as res.zsrc.zc was using single ZipCoder for one on-disk ZIP file despite each thread had its own instance of ZipFile for that on-disk ZIP file. res.zsrc is ZipFile.Source which contains a cache using single ZipCoder for multiple threads of the same on-disk ZIP file. Now for non-UTF8 ZIPs each ZipFile instance has its new ZipCoder. For regression risk the change is localized in ZipFile.java, the shared UTF8 ZipCoder is stateless and non-UTF8 ZipCoders are now created for each ZipFile instance. Multithreaded access to ZipFile must be synchronized by its user, not by ZipFile itself. That is documented by: In JDK21 ZipCoder (and its UTF8ZipCoder) is mostly the same as in JDK25. A customer has reported IllegalStateException on multithreaded ZipFile access with non-UTF8 charset after they migrated their codebase to JDK17. JDK17 backport sure needs JDK21 backport to be done first. JDK21 vs. JDK25 for src/java.base/share/classes/java/util/zip/ZipCoder.java:
|
Multithreaded handling of ZIP files can throw an exception.
This backport is far from clean. The last commit resolves the conflicts.
The backport would be a little cleaner if there was backported as a pre-requisite JDK-8321156. But given there is a backward compatibility concern I have not backported it.
(jdk25 already contains it), this jdk21, jdk17.
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/1949/head:pull/1949$ git checkout pull/1949Update a local copy of the PR:
$ git checkout pull/1949$ git pull https://git.openjdk.org/jdk21u-dev.git pull/1949/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1949View PR using the GUI difftool:
$ git pr show -t 1949Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/1949.diff
Using Webrev
Link to Webrev Comment