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

Stuart Marks smarks at openjdk.org
Fri Feb 28 01:04:01 UTC 2025


On Thu, 27 Feb 2025 13:51:27 GMT, Jason Mehrens <duke at openjdk.org> wrote:

>> 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.

It's correct that flush() was called under the lock previously, but there's no additional logic in this method, so I don't think it matters. If additional stuff is published it'll all get flushed eventually anyway. I note that ConsoleHandler.publish() flushes without holding the lock.

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

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


More information about the core-libs-dev mailing list