RFR: 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method
Jason Mehrens
duke at openjdk.org
Fri Feb 14 06:29:14 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).
src/java.logging/share/classes/java/util/logging/StreamHandler.java line 210:
> 208: if (!doneHeader) {
> 209: writer.write(getFormatter().getHead(this));
> 210: doneHeader = true;
Should getHead and or getTail also not be called while holding lock?
I format a single record in: https://eclipse-ee4j.github.io/angus-mail/docs/api/org.eclipse.angus.mail/org/eclipse/angus/mail/util/logging/CollectorFormatter.html#getTail(java.util.logging.Handler)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23491#discussion_r1955610861
More information about the core-libs-dev
mailing list