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

Jason Mehrens duke at openjdk.org
Thu Feb 27 18:58:06 UTC 2025


On Thu, 27 Feb 2025 12:46:36 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).
>
> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rewording notes and spec changes in docs.
>   Small change to read formatter once in streamhander methods.
>   Reverting Formatter doc changes for now.

src/java.logging/share/classes/java/util/logging/SocketHandler.java line 178:

> 176:         // JDK-8349206: Do NOT synchronize around the parent's publish() method.
> 177:         super.publish(record);
> 178:         flush();

May not matter, but flush should be called from synchronousPostWriteHook() as it was called under lock before this change.

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

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


More information about the core-libs-dev mailing list