RFR: 8333270: HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests fail with "Unexpected reference" if timeoutFactor is less than 1/3

Jaikiran Pai jpai at openjdk.org
Sat Jun 1 05:23:03 UTC 2024


On Fri, 31 May 2024 14:55:57 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> HandlersOnComplexResetUpdate and HandlersOnComplexUpdate tests verify that loggers are GC'ed (or not GC'ed) after a reset or an update. For that they poll a ReferenceQueue in a loop. The number of iteration is adjusted according to the jtreg timeout factor. However, the logic in the test did not expect that the timeout might be less than 1.
> 
> This fix does two things:
> 
> 1. fix the adjustCount logic - so that the number of iteration can only be increased
> 2. use remove(timeout) instead of poll() in order to minimize the waiting time.

test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java line 219:

> 217:         }
> 218:         WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue);
> 219:         if (!barRef.refersTo(barChild.getParent())) {

Hello Daniel, since `refersTo()` is the preferred API in cases like this, should this same change be done in the other `HandlersOnComplexUpdate` test that's being updated in this PR?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19503#discussion_r1623151595


More information about the core-libs-dev mailing list