On Fri, 25 Aug 2023 10:33:49 GMT, Jaikiran Pai <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java line 425:
>>
>>> 423: */
>>> 424: public static final Logger getLogger(String name, Module module) {
>>> 425: BootstrapLogger.detectBackend();
>>
>> Suggestion:
>>
>> // triggers detection of the backend
>> BootstrapLogger.detectBackend();
>
> Hello Daniel, Sean, I couldn't understand the need for this method. The
> changes to `BootstrapLogger` in this PR removes the initialization of
> `DetectBackend` class while holding a lock on `BootstrapLogger` class in the
> `BootstrapLogger.useLazyLoggers` method. Wouldn't that be enough?
a deadlock is still possible Jai with forcing class initialization here. The
new auto test confirms.
here's the interesting calling stack :
"Thread-0" #31 [2241170] prio=5 os_prio=0 cpu=32.77ms elapsed=13.69s
tid=0x00007fb0b019bf10 nid=2241170 waiting on condition [0x00007fb01ac29000]
java.lang.Thread.State: RUNNABLE
at
jdk.internal.logger.BootstrapLogger.useLazyLoggers(java.base@22-internal/BootstrapLogger.java:952)
- waiting on the Class initialization monitor for
jdk.internal.logger.BootstrapLogger$DetectBackend
at
jdk.internal.logger.LazyLoggers.getLazyLogger(java.base@22-internal/LazyLoggers.java:462)
at
jdk.internal.logger.LazyLoggers.getLogger(java.base@22-internal/LazyLoggers.java:437)
at java.lang.System.getLogger(java.base@22-internal/System.java:1822)
at
jdk.internal.event.EventHelper.isLoggingSecurity(java.base@22-internal/EventHelper.java:148)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15404#discussion_r1305856639