gdziadkiewicz commented on issue #279:
URL: 
https://github.com/apache/logging-log4net/issues/279#issuecomment-3696807638

   @FreeAndNil I was able to reproduce the issue using the provided test code, 
but my understanding is that this situation is only possible because 
`TriggerAdjust` calls the protected method `AdjustFileBeforeAppend`, which is 
accessible via inheritance from `RollingFileAppender` and can be invoked on 
demand. This does not appear to be a realistic usage scenario unless a consumer 
derives from `RollingFileAppender` and (arguably) misuses it.
   
   For consumers using `RollingFileAppender` as-is, I don’t see a path where 
`AdjustFileBeforeAppend` can be reached without already holding `LockObj`. It 
is only invoked from `RollingFileAppender.Append` (protected), which in turn is 
called from `AppenderSkeleton.DoAppend` (public), where the lock is taken.
   
   In `ExistingInit`, there is indeed a call to `RollOverTime` (via 
`RollOverIfDateBoundaryCrossing`) that could attempt to acquire `LockObj`, but 
this only occurs when `ExistingInit(true)` is used, which is not the case here.
   
   That said:
   
   1. Do we have any reports of this occurring in real-world usage? Details 
would help me investigate more.
   
   2. I haven’t yet measured the performance impact of adding a lock to 
`AdjustFileBeforeAppend`, but doing so would make the test cases pass and would 
harden the class against misuse via inheritance. If the analysis above is 
correct, this should not change observable behaviour, since the lock is already 
held in normal execution paths.


-- 
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