LoggerContext.size has a data race. getLogger() synchronizes on the current logger tree node,
but concurrent callers from different threads hold different monitors, so incSize() → size++
is unprotected. ThreadSanitizer reports:
==================
WARNING: ThreadSanitizer: data race (pid=246682)
Write of size 4 at 0x0006c0043a10 by thread T1908 (mutexes: write M0):
#0 ch.qos.logback.classic.LoggerContext.incSize() LoggerContext.java:167
#1 ch.qos.logback.classic.LoggerContext.getLogger(String) LoggerContext.java:156
#2 ch.qos.logback.classic.LoggerContext.getLogger(String) LoggerContext.java:53
#3 org.slf4j.LoggerFactory.getLogger(String) LoggerFactory.java:363
#4 org.slf4j.LoggerFactory.getLogger(Class) LoggerFactory.java:388
#5 ...
Previous write of size 4 at 0x0006c0043a10 by thread T1915 (mutexes: write M1):
#0 ch.qos.logback.classic.LoggerContext.incSize() LoggerContext.java:167
#1 ch.qos.logback.classic.LoggerContext.getLogger(String) LoggerContext.java:156
#2 ch.qos.logback.classic.LoggerContext.getLogger(String) LoggerContext.java:53
#3 org.slf4j.LoggerFactory.getLogger(String) LoggerFactory.java:363
#4 org.slf4j.LoggerFactory.getLogger(Class) LoggerFactory.java:388
#5 ...
==================
LoggerContext.size has a data race. getLogger() synchronizes on the current logger tree node,
but concurrent callers from different threads hold different monitors, so incSize() → size++
is unprotected. ThreadSanitizer reports: