RFR: 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method [v7]
Daniel Fuchs
dfuchs at openjdk.org
Fri Feb 28 09:16:01 UTC 2025
On Fri, 28 Feb 2025 00:59:22 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> 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.
If that mattered it could be called within the `synchronousPostWriteHook` instead, but I agree with @stuart-marks that it most probably doesn't matter.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23491#discussion_r1975069382
More information about the core-libs-dev
mailing list