RFR: 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method

Daniel Fuchs dfuchs at openjdk.org
Wed Feb 12 18:44:11 UTC 2025


On Thu, 6 Feb 2025 12:07:57 GMT, David Beaumont <duke at openjdk.org> wrote:

> 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method.
> 
> 1. Remove synchronization of calls to publish() in Handlers in java.util.logging package.
> 2. Add explanatory comments to various affected methods.
> 3. Add a test to ensure deadlocks no longer occur.
> 
> Note that this change does not address issue in MemoryHandler (see JDK-8349208).

test/jdk/java/util/logging/LoggingDeadlock5.java line 115:

> 113: 
> 114:     private static class DeadLocker {
> 115:         private final static Duration JOIN_WAIT = Duration.ofMillis(500);

You might want to use `jdk.test.lib.Utils.adjustTimeout()` here to account for the case when the test is run on slower configurations. Typically in higher tiers, this test might be run with -Xcomp or -Xint and on debug builds which might cause slow downs and cause the join() method to exit too early - reporting false positives.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23491#discussion_r1953217354


More information about the core-libs-dev mailing list