You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[1.2 bridge] callAppenders can throw NPE when removeAllAppenders runs concurrently #4512
but Category.removeAllAppenders is not synchronized: it iterates the appenders, calls aai.removeAllAppenders(), fires remove events, and only then sets aai = null. If another thread's callAppenders passes the null check in between, it dereferences the nulled aai and throws NullPointerException. The field is also not volatile, so the window is wider than the race itself.
Trigger: one thread logging through a 1.2-bridge Category in a loop while another thread calls removeAllAppenders() on it (e.g. a reconfiguration path). I have not executed this — reporting from code reading plus a model of the interleaving, so please treat the report with appropriate skepticism; a sketch of the reproducer is below.
Configuration
Version: 2.x branch HEAD (verified 2026-11-21)
Operating system: N/A (code reading; any OS)
JDK: N/A (any; would reproduce with e.g. OpenJDK 21+ and a two-thread JUnit test)
Logs
None (no execution; the NPE site is Category.java:249, c.aai.appendLoopOnAppenders(event) after aai is nulled at line 584).
Reproduction
Unrun sketch (two threads sharing one Category: one calling a logging method in a tight loop, one calling removeAllAppenders() repeatedly; expect intermittent NPE from callAppenders). I can turn this into a real JUnit test in the repo's style if the diagnosis looks right — just say the word.
Possible direction: synchronize removeAllAppenders (and ideally removeAppender, same shape) on the Category, matching callAppenders.
Activity