RFR: 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method [v9]
Stuart Marks
smarks at openjdk.org
Fri Feb 28 01:11:58 UTC 2025
On Thu, 27 Feb 2025 17:15:56 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:
>
> Fix @implNote to @apiNote.
src/java.logging/share/classes/java/util/logging/StreamHandler.java line 288:
> 286: doneHeader = true;
> 287: }
> 288: writer.write(formatter.getTail(this));
Strictly speaking not necessary, since this is called with the lock held (as noted above!) but it's a reasonably good multi-threaded coding practice to fetch values into a local variable and reuse them, so I think this is ok as modified.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23491#discussion_r1974584279
More information about the core-libs-dev
mailing list