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

8257817: Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB #1662

Closed
wants to merge 1 commit into from

Conversation

rkennke
Copy link
Contributor

@rkennke rkennke commented Dec 7, 2020

The weak-LRB code is currently subject to a race. Consider this sequence of events between a Java thread and GC threads:
During conc-weak-root-in-progress:

  • Java: Load referent out of Reference, it is unreachable but not-yet-cleared
  • GC: Clears referent
  • GC: Concurrently turn off conc-weak-root-in-progress
  • Java: Checks conc-weak-root-in-progress, sees that it's false, continues to use/evac it -> successfully resurrected unreachable object. This must not happen.

AFAICT, this also affects conc-class-unloading and weak-roots.

Proposed fix is to check for evac-in-progress instead. This should be acceptable because this is not a very common path and not very performance-sensitive.

  • hotspot_gc_shenandoah

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8257817: Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1662/head:pull/1662
$ git checkout pull/1662

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Dec 7, 2020

👋 Welcome back rkennke! 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 openjdk bot commented Dec 7, 2020

@rkennke The following labels will be automatically applied to this pull request:

  • hotspot-gc
  • shenandoah

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot-gc shenandoah labels Dec 7, 2020
@rkennke rkennke changed the title Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB 8257817: Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB Dec 7, 2020
@openjdk openjdk bot added the rfr label Dec 7, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Dec 7, 2020

Webrevs

Copy link
Contributor

@zhengyu123 zhengyu123 left a comment

I wonder if it is more general problem. Given concurrent weak root in mandatory phase, we should just remove is_concurrent_weak_root_in_progress flag.

@rkennke rkennke closed this Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc rfr shenandoah
2 participants