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

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

Closed
wants to merge 2 commits into from

Conversation

@kimbarrett
Copy link
Contributor

@kimbarrett kimbarrett commented Jun 20, 2021

Please review this fix of
vmTestbase/gc/gctests/PhantomReference/phantom001/phantom001.java
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
coming.

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.

Testing:
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


Progress

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

Issue

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

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/106/head:pull/106
$ git checkout pull/106

Update a local copy of the PR:
$ git checkout pull/106
$ git pull https://git.openjdk.java.net/jdk17 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:
https://git.openjdk.java.net/jdk17/pull/106.diff

@bridgekeeper
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.

@openjdk
Copy link

@openjdk openjdk bot commented Jun 20, 2021

@kimbarrett
The hotspot-gc label was successfully added.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 20, 2021

Webrevs

@kimbarrett
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