Skip to content
This repository has been archived by the owner. It is now read-only.

8260684: vmTestbase/gc/gctests/PhantomReference/phantom002/ timed out #106

wants to merge 2 commits into from


Copy link

@kimbarrett kimbarrett commented Jun 20, 2021

Please review this fix of
to eliminate a race that can lead to the test very occasionally hanging and
eventually timing out.

When the referent being tested by a particular iteration is a finalizable
class, the test invoked eatMemory() repeatedly until the referent's
finalize() function set a flag, then called eatMemory() once more to cause
the reference to be cleared and notified. The problem with this is that
eatMemory() might trigger its GCs before the finalization thread has dropped
the referent, so the referent is still live and the reference has not been
cleared and notified afterward.

The testing thread then proceeds to wait for the reference to be notified.
This usually doesn't cause a problem because other threads will trigger
further GCs, and the finalization thread will eventually drop the object.
However, if the test is nearing completion and this situation arises in the
last thread running, it will wait forever for the notification that isn't

While investigating this issue I did a bunch of code cleanup (for example,
there was some really badly formatted code), refactoring, and commenting.
As a result, a large fraction of the test has changed, though mostly in ways
that don't affect it's function. The first of the two commits in the PR is
a whitespace-only cleanup. Excluding it may make reviewing easier.

Ran the phantom002 test a couple thousand times.

Using a modified version of the test, verified that the described problem
case actually occurs; that is, one eatMemory call is sometimes insufficient
to cause clearing of the reference because the referent is still live on the
finalization thread.

/label hotspot-gc


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


  • JDK-8260684: vmTestbase/gc/gctests/PhantomReference/phantom002/ timed out


Using git

Checkout this PR locally:
$ git fetch pull/106/head:pull/106
$ git checkout pull/106

Update a local copy of the PR:
$ git checkout pull/106
$ git pull pull/106/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 106

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

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented Jun 20, 2021

👋 Welcome back kbarrett! 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.

Copy link

@openjdk openjdk bot commented Jun 20, 2021

The hotspot-gc label was successfully added.

Copy link

@mlbridge mlbridge bot commented Jun 20, 2021


Copy link
Contributor Author

@kimbarrett kimbarrett commented Jun 20, 2021

Oops, I messed up the last change, and testing didn't find it. Withdrawing this change.

@kimbarrett kimbarrett closed this Jun 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
1 participant