FreeAndNil commented on code in PR #322:
URL: https://github.com/apache/logging-log4net/pull/322#discussion_r4072805979


##########
src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs:
##########
@@ -442,9 +466,7 @@ protected void ParseChildrenOfLoggerElement(XmlElement 
catElement, Logger log, b
       }
     }
 
-    // Phase 2: atomic swap — replace all appenders in one writer lock so
-    // the logger is never in a zero-appender state for longer than it takes
-    // to acquire and release the lock (microseconds, not milliseconds).
+    // Phase 2: swap in one writer lock, closing the outgoing appenders.
     log.ReplaceAppenders(newAppenders);

Review Comment:
   Confirmed as a real window, but not one this change introduces.
   
   - before this change the incoming appender opened its file during parsing, 
deterministically, while the outgoing one still held it: that is #321
   - deferring activation turns that certainty into a race that needs a log 
call concurrent with reconfiguration
   - it is reachable only through TextWriterAppender.PreAppendCheck, the only 
PreAppendCheck override in the library, so FileAppender and RollingFileAppender 
and nothing else, and only under the default ExclusiveLock
   - it is self healing: SafeOpenFile reports through the ErrorHandler and 
leaves the writer null, PrepareWriter retries on the next event, and OpenFile 
resets before reopening, so the pending ActivateOptions recovers it. The cost 
is one error message and a dropped event, not a stuck appender
   - closing it properly means blocking or buffering: either hold every 
logger's writer lock across the swap and the activation, which stalls the 
logging threads for as long as activation takes, up to a file lock retry 
timeout, or add a repository level reconfiguring state that queues events and 
replays them after activation
   - both are design changes rather than a fix, so tracking them as a follow-up 
rather than widening this one



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to