RFR: 8298783: java/lang/ref/FinalizerHistogramTest.java failed with "RuntimeException: MyObject is not found in test output" [v9]
Kim Barrett
kbarrett at openjdk.org
Sat May 3 00:38:47 UTC 2025
On Thu, 1 May 2025 21:47:01 GMT, Brent Christian <bchristi at openjdk.org> wrote:
>> I propose some cleanups to `FinalizerHistogramTest.java` to hopefully clear up the intermittent failures:
>>
>> * run with `othervm`: this test blocks the (global) finalizer thread, and also requires the (global) finalizer thread to enter the test's `finalize()` method
>> * The test uses `volatile` ints, but sets them based on their current value, which is not reliable; convert to `AtomicInteger`
>> * use `PhantomReference`s to ensure that at least two `MyObject`s have become unreachable. If one is stuck in `finalize()`, at least one is still waiting to be finalized and should show up in the histogram.
>
> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
>
> remove unneeded 'trappedCount'
test/jdk/java/lang/ref/FinalizerHistogramTest.java line 78:
> 76: refProResult = wb.waitForReferenceProcessing();
> 77: System.out.println("waitForReferenceProcessing returned: " + refProResult);
> 78: } while (refProResult);
Why the spammy output? Why not just
while (wb.waitForReferenceProcessing()) {}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24143#discussion_r2072259958
More information about the core-libs-dev
mailing list