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

8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux #10267

Closed
wants to merge 2 commits into from

Conversation

bplb
Copy link
Member

@bplb bplb commented Sep 14, 2022

Files in /proc advertise a size of zero for which direct and mapped transfers do not work. For this case, fall back to arbitrary channel transfer.


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-8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10267

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 14, 2022

👋 Welcome back bpb! 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 Pull request is ready for review label Sep 14, 2022
@openjdk
Copy link

openjdk bot commented Sep 14, 2022

@bplb The following label will be automatically applied to this pull request:

  • nio

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 nio nio-dev@openjdk.org label Sep 14, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 14, 2022

Webrevs

if (src instanceof FileChannelImpl fci) {
// System calls supporting fast transfers might not work on files
// which advertise zero size such as those in Linux /proc
if (src instanceof FileChannelImpl fci && fci.size() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This means an extra fstat per transferFrom but maybe you've measured it with small files and it's okay?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's about 20% slower for sizes 32 and 4096 (disk block size), and about 13% slower for size 32768. Instead making the direct and trusted methods fail independently does not help.

test/jdk/java/nio/file/Files/CopyProcFile.java Outdated Show resolved Hide resolved
test/jdk/java/nio/file/Files/CopyProcFile.java Outdated Show resolved Hide resolved
test/jdk/java/nio/file/Files/CopyProcFile.java Outdated Show resolved Hide resolved
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.

Thanks for the updates, 9590119 looks good.

@openjdk
Copy link

openjdk bot commented Sep 16, 2022

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

8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux

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

  • f42caef: 8293550: Optionally add get-task-allow entitlement to macos binaries
  • 5feca68: 8293840: RISC-V: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • 39cd163: 8293578: Duplicate ldc generated by javac
  • 7765942: 8290367: Update default value and extend the scope of com.sun.jndi.ldap.object.trustSerialData system property
  • 11e7d53: 8293819: sun/util/logging/PlatformLoggerTest.java failed with "RuntimeException: Retrieved backing PlatformLogger level null is not the expected CONFIG"
  • 141d5f5: 8293767: AWT test TestSinhalaChar.java has old SCCS markings
  • 3beca2d: 8291600: [vectorapi] vector cast op check is not always needed for vector mask cast
  • 9a40b76: 8293842: IPv6-only systems throws UnsupportedOperationException for several socket/TCP options
  • bb9aa4e: 8293813: ProblemList com/sun/jdi/JdbLastErrorTest.java on windows-x64 in Xcomp mode
  • 4cec141: 8291509: Minor cleanup could be done in sun.security
  • ... and 43 more: https://git.openjdk.org/jdk/compare/524af949370990df6f58a84ad2493eb1dcba2231...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 Pull request is ready to be integrated label Sep 16, 2022
@bplb
Copy link
Member Author

bplb commented Sep 19, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Sep 19, 2022

Going to push as commit 6e23b43.
Since your change was applied there have been 80 commits pushed to the master branch:

  • 1f9ff41: 8292297: Fix up loading of override java.security properties file
  • 64b96e5: 8293811: Provide a reason for PassFailJFrame.forceFail
  • f91762f: 8293965: Code signing warnings after JDK-8293550
  • 8082c24: 8054572: [macosx] JComboBox paints the border incorrectly
  • b920d29: 8271328: User is able to choose the color after disabling the color chooser.
  • 5725a93: 8293879: Remove unnecessary castings in jdk.hotspot.agent
  • ab7f58a: 6286501: JTabbedPane throws NPE from its stateChanged listener in particular case
  • d41f69f: 8293849: PrintIdealPhase in compiler directives file is ignored when used with other compile commands
  • 471e2f1: 8292088: C2: assert(is_OuterStripMinedLoop()) failed: invalid node class: IfTrue
  • a93cf92: 8293920: G1: Add index based heap region iteration
  • ... and 70 more: https://git.openjdk.org/jdk/compare/524af949370990df6f58a84ad2493eb1dcba2231...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 19, 2022

@bplb Pushed as commit 6e23b43.

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

@bplb bplb deleted the FileChannel-transfer-proc-8293502 branch September 21, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated nio nio-dev@openjdk.org
2 participants