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

8303891: Speed up Zip64SizeTest using a small ZIP64 file #12948

Closed
wants to merge 18 commits into from

Conversation

eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Mar 9, 2023

Please review this PR which suggests we speed up the Zip64SizeTest using a small-sized ZIP64 ZIP file specifically created to reproduce the issue being tested.

The disk space requirement of this test is known to cause problems in some builds, see JDK-8259866

By using a sparse file, we reduce consumed disk space from 5GB to 266 bytes and also reduce the runtime from ~35 seconds to ~1 seconds on my Macbook Pro.

The PR also fixes the @summary tag, which seems to have been copied from an unrelated test.


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-8303891: Speed up Zip64SizeTest using a small ZIP64 file (Enhancement - P4)
  • JDK-8259866: two java.util tests failed with "IOException: There is not enough space on the disk" (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12948

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 9, 2023

👋 Welcome back eirbjo! 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 Mar 9, 2023

@eirbjo 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 Mar 9, 2023
@eirbjo eirbjo changed the title 8303891: Zip64SizeTest should use a sparse file 8303891: Zip64SizeTest could use a sparse file Mar 9, 2023
@eirbjo eirbjo marked this pull request as ready for review March 9, 2023 12:14
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 9, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 9, 2023

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 7, 2023

@eirbjo 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 add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented May 6, 2023

@eirbjo This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this May 6, 2023
@eirbjo eirbjo changed the title 8303891: Zip64SizeTest could use a sparse file 8303891: Speed up Zip64SizeTest using a sparse file Dec 28, 2023
@eirbjo eirbjo changed the title 8303891: Speed up Zip64SizeTest using a sparse file 8303891: Speed up Zip64SizeTest using a small ZIP64 file Feb 8, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Feb 8, 2024

/open

@openjdk openjdk bot reopened this Feb 8, 2024
@openjdk
Copy link

openjdk bot commented Feb 8, 2024

@eirbjo This pull request is now open

@eirbjo
Copy link
Contributor Author

eirbjo commented Feb 8, 2024

Reopening this PR which was closed without review in May 2023.

Initially, this PR suggested to use a sparse file when creating the large ZIP file. After consideration, I have found it simpler to instead doctor a small-sized ZIP64-entry with the specific structure required to trigger the regression being tested.

I have verified that the test actually fails if ZipFile is updated to call ZipEntry.setExtra0 with isLoc: true, meaning it still catches the regression.

@eirbjo
Copy link
Contributor Author

eirbjo commented Feb 8, 2024

/issue add 8259866

@openjdk
Copy link

openjdk bot commented Feb 8, 2024

@eirbjo
Adding additional issue to issue list: 8259866: two java.util tests failed with "IOException: There is not enough space on the disk".


ZipEntry e1 = new ZipEntry("first");
// Make room for an 8-byte ZIP64 extra field
e1.setExtra(createOpaqueExtra((short) Long.BYTES));
Copy link
Member

Choose a reason for hiding this comment

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

Hello Eirik, I couldn't understand why we first add a opaque extra field first and then update it to be a zip64 extra field. Why do we do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello Eirik, I couldn't understand why we first add a opaque extra field first and then update it to be a zip64 extra field. Why do we do this?

ZipEntry.setExtra processes the byte array argument, looking for Zip64 extended fields which it can extract the size fields from. To prevent this parsing from happening, we temporarily use the unknown tag.

In this particular case, ZipExtra.setExtra actually ends up skipping this processing (because isLOC == true and it has a guard for the block size being >= 16).

However, I prefer the test to not depend too much on the details of setExtra Zip64 processing. This trick is used in other tests as well and may be copied over to a test where the conditions are not the same.

I have refactored a bit and added some code comments to help explain the use of the 'unknown' tag.

Do you think this makes sense?

Copy link
Member

Choose a reason for hiding this comment

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

Hello Eirik, thank you for that detail. Yes, what you note and the updated comment, looks good to me.

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

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

thank you for the latest updates Eirik.

Overall it is good a few more comment suggestions for extra clarity.

ZipEntry e1 = new ZipEntry("first");

// Make an extra field with the correct size for an 8-byte 'uncompressed size'
// Zip64 field. Temporarily use the 'unknown' tag 0x9902 to make
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest adding a reference to the following in the APPNOTE.TXT to make clearer where that value came from

4.6.1 Third party mappings commonly used are:

another suggestion would be to show the CEN here with this change I think would make it easier for someone who is not as familiar with APPNOTE.TXT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CEN structure is already descibed in the method-level documentation. Would you prefer I move it into the code? Not sure I would like to repeat it, and I think perhaps it's better to have the whole structure in once place, instead of splitting it (since the Zip64 extra corresponds to the CEN header fields).

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would suggest adding a reference to the following in the APPNOTE.TXT to make clearer where that value came from

Added a reference to "Third Party Mappings". (It's not super-important that we chose 'unknown' here, it just seemed a reasonable choice for something ZipEntry cannot see into)

}
}
}
private static void updateCENHeaderToZip64(byte[] zip) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Again minor but perhaps articulate that after this call, the extra data will be(obvious to you and I but probably not to others...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again minor but perhaps articulate that after this call, the extra data will be(obvious to you and I but probably not to others...)

Added zipdetails describing the resulting ZIP64 structure to the updateCENHeaderToZip64 method documentation.

@openjdk
Copy link

openjdk bot commented Feb 9, 2024

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

8303891: Speed up Zip64SizeTest using a small ZIP64 file
8259866: two java.util tests failed with "IOException: There is not enough space on the disk"

Reviewed-by: lancea, 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 115 new commits pushed to 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 ready Pull request is ready to be integrated label Feb 9, 2024
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.

These test-only changes look good to me.

@eirbjo
Copy link
Contributor Author

eirbjo commented Feb 13, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Feb 13, 2024

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

  • 243fb46: 8325750: Fix spelling of ForceTranslateFailure help message
  • 74b90aa: 8325672: C2: allocate PhaseIdealLoop::_loop_or_ctrl from C->comp_arena()
  • 6dfa7f3: 8325541: C2 SuperWord: refactor filter / split
  • 6b7c971: 8325382: (fc) FileChannel.transferTo throws IOException when position equals size
  • 13d9e8f: 8325590: Regression in round-tripping UTF-16 strings after JDK-8311906
  • 57b04e1: 8325748: Serial: Move Generation::promote to TenuredGeneration
  • 7cd25ed: 8322854: Incorrect rematerialization of scalar replaced objects in C2
  • 7ec2bad: 8323520: Drop unnecessary virtual specifier in Space
  • 71ff2d7: 8325616: JFR ZGC Allocation Stall events should record stack traces
  • c3c1cdd: 8325731: Installation instructions for Debian/Ubuntu don't mention autoconf
  • ... and 117 more: https://git.openjdk.org/jdk/compare/692c9f8821e220560927dd6bbedfea9ddfe312f6...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 13, 2024

@eirbjo Pushed as commit 842b895.

💡 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
Development

Successfully merging this pull request may close these issues.

3 participants