On Tue, 29 Apr 2025 22:46:22 GMT, Brent Christian <bchri...@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: > > convert test to use WhiteBox Changes requested by kbarrett (Reviewer). test/jdk/java/lang/ref/FinalizerHistogramTest.java line 77: > 75: wb = WhiteBox.getWhiteBox(); > 76: wb.fullGC(); > 77: refProResult = wb.waitForReferenceProcessing(); WhiteBox::waitForReferenceProcessing returns true if some progress has been made, not if all the processing is done. Probably need a loop here, e.g. while (wb.waitForReferenceProcessing()) {} // All finalizable objects from prior gcs have made it to the finalizer queue. test/jdk/java/lang/ref/FinalizerHistogramTest.java line 79: > 77: refProResult = wb.waitForReferenceProcessing(); > 78: System.out.println("waitForReferenceProcessing returned: " + > refProResult); > 79: while(trappedCount.get() < 1); This doesn't seem to be doing anything? trappedCount is initially 0, and only incremented. ------------- PR Review: https://git.openjdk.org/jdk/pull/24143#pullrequestreview-2805296214 PR Review Comment: https://git.openjdk.org/jdk/pull/24143#discussion_r2067567008 PR Review Comment: https://git.openjdk.org/jdk/pull/24143#discussion_r2067567096