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

8290848: LoadLibraryUnload.java still fails with "Too few cleared WeakReferences" #9649

Closed
wants to merge 2 commits into from

Conversation

RogerRiggs
Copy link
Contributor

@RogerRiggs RogerRiggs commented Jul 26, 2022

The intermittent test failure was due to the WeakReferences being unreferenced too early.
Adding a Reference.reachabilityFence to the test makes it robust.

Remove from ProblemList-Xcomp.txt


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-8290848: LoadLibraryUnload.java still fails with "Too few cleared WeakReferences"

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9649

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 26, 2022

👋 Welcome back rriggs! 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 Jul 26, 2022
@openjdk
Copy link

openjdk bot commented Jul 26, 2022

@RogerRiggs 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 Jul 26, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 26, 2022

Webrevs

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

This looks good. Glad that you fxied this hard to find issue.

@openjdk
Copy link

openjdk bot commented Jul 26, 2022

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

8290848: LoadLibraryUnload.java still fails with "Too few cleared WeakReferences"

Reviewed-by: mchung, 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 8 new commits pushed to the master branch:

  • 2f3e494: 8290074: Remove implicit arguments for RegisterMap constructor
  • e804236: 8291289: gc/TestPLABAdaptToMinTLABSize fails after JDK-8289137
  • adaf3b9: 8291056: Remove unused Generation::par_promote*()
  • 48b77a6: 8285792: Posix signal handler modification checking issues.
  • 8ec3197: 8291002: Rename Method::build_interpreter_method_data to Method::build_profiling_method_data
  • 61e072d: 8290705: StringConcat::validate_mem_flow asserts with "unexpected user: StoreI"
  • 2bd90c2: 8284990: AArch64: Remove STXR_PREFETCH from CPU features
  • 2a1d9cf: 8289137: Automatically adapt Young/OldPLABSize and when setting only MinTLABSize

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 Jul 26, 2022
@jaikiran
Copy link
Member

jaikiran commented Jul 27, 2022

Hello Roger, considering that the wCanary array will be "alive" at least till the end of the loop at line 126 (the loop within which we create the WeakReference instances and register them with the refQueue), shouldn't the refQueue be enqueued with these WeakReferences, even if wCanary gets unreferenced at line 126? Thus, shouldn't the refQueue have these unreferenced instances at line 169 - the place where we call refQueue.remove(Utils.adjustTimeout(30 * 1000L));?

@RogerRiggs
Copy link
Contributor Author

Hi Jai,

The actions related to References are only true if the Reference (or subtype) is reachable.
In this case, if the WeakReference cannot be reached from some other root, its semantics are void.

Note that initially the WeakReference refers to the queue not the other way around.
Reference processing occurs from the roots and conditionally gaining semantics when traversing through Reference objects.
So at least until the weakly-reachable condition is satisfied the WeakReference must be reachable from another (strong) root.

https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/ref/package-summary.html#reachability

@jaikiran
Copy link
Member

Thank you Roger for that explanation. That helped.

@RogerRiggs
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 27, 2022

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

  • 9234624: Merge
  • 36c00fd: 8291006: java/foreign/TestUnsupportedPlatform fails after JDK-8290455
  • 8c9d5ad: 8290455: jck test api/java_lang/foreign/VaList/Empty.html fails on some platforms
  • c29242e: 8290460: Alpine: disable some panama tests that rely on std::thread
  • 2f3e494: 8290074: Remove implicit arguments for RegisterMap constructor
  • e804236: 8291289: gc/TestPLABAdaptToMinTLABSize fails after JDK-8289137
  • adaf3b9: 8291056: Remove unused Generation::par_promote*()
  • 48b77a6: 8285792: Posix signal handler modification checking issues.
  • 8ec3197: 8291002: Rename Method::build_interpreter_method_data to Method::build_profiling_method_data
  • 61e072d: 8290705: StringConcat::validate_mem_flow asserts with "unexpected user: StoreI"
  • ... and 2 more: https://git.openjdk.org/jdk/compare/4d796ee8abd4eabc5d5d3034f236e8f4289ca048...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 27, 2022

@RogerRiggs Pushed as commit c104089.

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

@RogerRiggs RogerRiggs deleted the 8290848-unload-too-few branch December 11, 2023 17:25
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