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

8290231: java/foreign/malloc/TestMixedMallocFree.java crashed in JDK19 ATR run #11417

Closed
wants to merge 1 commit into from

Conversation

JornVernee
Copy link
Member

@JornVernee JornVernee commented Nov 29, 2022

This test allocates on the native side with malloc, and then tries to free that memory on the Java side. The library that we look up on the Java side is either ucrtbase.dll, or msvcrt.dll as a fallback if we don't find it. The fact that we're seeing this crash likely means that the test machine doesn't have ucrtbase.dll, but it does have a newer standard runtime library other than msvcrt.dll (one of the msvcp*.dll libraries).

So, what can happen is: the native code in the test ends up being linked against this newer runtime library. We allocate using the newer runtime library's malloc function. Look up free from Java, don't find ucrtbase.dll so fall back to msvcrt.dll. Call free from msvcrt.dll which is not the right one, and then crash due to the allocator mismatch.


I think we should just remove this test. In practice, we can not guarantee that native code is linked against the same dll as the one we pick to be the default library (for instance, the native code could have been linked against an older dll, even while ucrtbase.dll is present on the system).

Trying to mach up the 2 libraries was important when we had public allocateMemory and freeMemory functions, but those were removed from the API.

Using matching allocate & free pairs, which some of the other tests do, still works.


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-8290231: java/foreign/malloc/TestMixedMallocFree.java crashed in JDK19 ATR run

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11417

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 29, 2022

👋 Welcome back jvernee! 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 Nov 29, 2022

@JornVernee 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 Nov 29, 2022
@JornVernee JornVernee marked this pull request as ready for review November 29, 2022 16:06
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 29, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 29, 2022

Webrevs

Copy link
Contributor

@mcimadamore mcimadamore left a comment

Choose a reason for hiding this comment

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

Looks good - I agree this test isn't useful anymore

@openjdk
Copy link

openjdk bot commented Nov 29, 2022

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

8290231: java/foreign/malloc/TestMixedMallocFree.java crashed in JDK19 ATR run

Reviewed-by: mcimadamore

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

  • ae5b1f7: 8297685: Typo in NullPointerException description specified by Locale.lookup
  • 3ce0042: 8297780: Problem list java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java
  • b778cd5: 8295010: Reduce if required in EC limbs operations
  • 54e6d6a: 8293488: Add EOR3 backend rule for aarch64 SHA3 extension

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 Nov 29, 2022
@JornVernee
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 30, 2022

Going to push as commit 1722f9c.
Since your change was applied there have been 37 commits pushed to the master branch:

  • 1a2ff58: 8297736: test/jdk/java/foreign/TestMatrix.java is broken
  • 6bac332: 8297853: windows-x86 test build broken
  • 53dd214: 8297742: Combine vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount tests
  • 1323e98: 8297170: misc JCK tests fail with "FATAL ERROR in native method: JDWP Can't disable vthread end events, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)"
  • c685569: 8297731: Remove redundant check in MutableBigInteger.divide
  • dcf431d: 8287400: Make BitMap range parameter names consistent
  • a1f4db5: 8297584: G1 parallel phase event for scan heap roots is sent too often
  • be4245e: 8294924: JvmtiExport::post_exception_throw() doesn't deal well with concurrent stack processing
  • be99e84: 8296875: Generational ZGC: Refactor loom code
  • 301cf52: 8297284: ResolutionErrorTable's key is wrong
  • ... and 27 more: https://git.openjdk.org/jdk/compare/69ede5baeda6645aa3e961a02cbd40db965fc6a1...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 30, 2022

@JornVernee Pushed as commit 1722f9c.

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

@JornVernee JornVernee deleted the RemoveTMMF branch December 1, 2022 15:55
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.

2 participants