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

8309475: Test java/foreign/TestByteBuffer.java fails: a problem with msync (aix) #14964

Closed

Conversation

backwaterred
Copy link
Contributor

@backwaterred backwaterred commented Jul 20, 2023

This change adds additional support to MappedByteBuffer::force which delegates to msync on AIX. Specifically, it checks whether and error with errno set to EINVAL is the cause of a msync call to an address mmapped with the MAP_PRIVATE flag set. If this flag is set, then the msync call EINVAL is expected, and can be ignored as per the Java documentation of the force method.

In particular, the method has no effect for buffers mapped in read-only or private mapping modes. [1]

Separated into separate file as per recommendation by @AlanBateman.

[1] https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/nio/MappedByteBuffer.html#force()


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-8309475: Test java/foreign/TestByteBuffer.java fails: a problem with msync (aix) (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14964

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 20, 2023

👋 Welcome back tsteele! A progress list of the required criteria for merging this PR into pr/14963 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 changed the title 8309475 8309475: Test java/foreign/TestByteBuffer.java fails: a problem with msync (aix) Jul 20, 2023
@openjdk
Copy link

openjdk bot commented Jul 20, 2023

@backwaterred 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 Jul 20, 2023
@backwaterred backwaterred marked this pull request as ready for review July 25, 2023 14:24
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 25, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 25, 2023

Webrevs

@AlanBateman
Copy link
Contributor

It's good that this doesn't clutter the Unix implementation of these methods with a lot of AIX-specific code. However, part of me wonders if force should special case the read-only or private mapping cases so that it's just a no-op, need to think about that one as the MBB implementation doesn't know if the mapping is read-write or private.

@backwaterred
Copy link
Contributor Author

part of me wonders if force should special case the read-only or private mapping cases so that it's just a no-op, need to think about that one as the MBB implementation doesn't know if the mapping is read-write or private.

I agree with the sentiment. It would be nice to have this information available without so much heavy lifting.

@RealCLanger
Copy link
Contributor

FYI: We are excluding the failing test for the time being in #15055. The exclusion will need to be removed with the final commit for this.

@backwaterred
Copy link
Contributor Author

Thanks for mentioning it @RealCLanger. I'll remove the exception from the ProblemList before I merge.

This PR and #14963 are ready for reviews if anyone has a chance to take a look.

@backwaterred backwaterred marked this pull request as draft July 31, 2023 21:40
@openjdk
Copy link

openjdk bot commented Jul 31, 2023

⚠️ @backwaterred This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot removed the rfr Pull request is ready for review label Jul 31, 2023
@backwaterred
Copy link
Contributor Author

Fixing chaos brought on by merging with upstream/master branch.

@backwaterred backwaterred marked this pull request as ready for review July 31, 2023 21:47
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 31, 2023
@TOatGithub
Copy link
Contributor

Code seems reasonable: on msync error EINVAL retrieves info about flags of mapped region and reacts accordingly.

@backwaterred
Copy link
Contributor Author

Thanks Thomas 😄

Copy link
Contributor

@TOatGithub TOatGithub left a comment

Choose a reason for hiding this comment

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

Code seems reasonable: on msync error EINVAL retrieves info about flags of mapped region and reacts accordingly.

Copy link
Contributor

@JoKern65 JoKern65 left a comment

Choose a reason for hiding this comment

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

This is a reasonable solution for the problem.

@MBaesken
Copy link
Member

The compile error above mentioned by Martin is observed with xlC 17.1.1 (build with xlc16 still works).

Copy link
Member

@MBaesken MBaesken left a comment

Choose a reason for hiding this comment

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

Otherwise looks okay but please fix the xlc17 build before pushing.

@backwaterred
Copy link
Contributor Author

There are some issues with the integration tests apparently. Those failures do not appear related to my changes:

Package g++-10 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

@TheRealMDoerr
Copy link
Contributor

(uint64_t)end_address <= (uint64_t)map_entry->pr_vaddr + map_entry->pr_size works with xlc 17.

@backwaterred
Copy link
Contributor Author

backwaterred commented Aug 14, 2023

(uint64_t)end_address <= (uint64_t)map_entry->pr_vaddr + map_entry->pr_size works with xlc 17.

I thought it might complain about that as well. Thanks for testing. I made this change.

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.

The removal of the AIX specific code from the Unix version of MappedMemoryUtils.c look fine. At some point I think we should re-visit this as the force method should be a no-op for the read-only or private mapping cases so this code should not be needed.

@MBaesken
Copy link
Member

The build now works as well with xlc17.

@openjdk-notifier openjdk-notifier bot changed the base branch from pr/14963 to master August 18, 2023 14:03
@openjdk-notifier
Copy link

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout aix/TestByteBuffer-alternate
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@TheRealMDoerr
Copy link
Contributor

I think you need to remove "java/foreign/TestByteBuffer.java 8309475 aix-ppc64" from test/jdk/ProblemList.txt.

@backwaterred
Copy link
Contributor Author

Good point. I did that after the last merge too :-)

@openjdk
Copy link

openjdk bot commented Aug 18, 2023

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

8309475: Test java/foreign/TestByteBuffer.java fails: a problem with msync (aix)

Reviewed-by: mbaesken, alanb, mdoerr

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Aug 18, 2023
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr 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!

@backwaterred
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 18, 2023

Going to push as commit 395fc78.
Since your change was applied there have been 4 commits pushed to the master branch:

  • f481477: 8314320: Mark runtime/CommandLine/ tests as flagless
  • fbe28ee: 8314481: JDWPTRANSPORT_ERROR_INTERNAL code in socketTransport.c can never be executed
  • 50a2ce0: 8310815: Clarify the name of the main class, services and provider classes in module descriptor
  • aecbb1b: 8314448: Coordinate DocLint and JavaDoc to report on unknown tags

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 18, 2023

@backwaterred Pushed as commit 395fc78.

💡 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
integrated Pull request has been integrated nio nio-dev@openjdk.org
7 participants