Make copy of appender list when removing all, for increased thread-safety#222
Make copy of appender list when removing all, for increased thread-safety#222tmct wants to merge 3 commits into
Conversation
|
@tmct thanks for your pull request. I would prefer the pattern already used in AppendLoopOnAppenders(): _appenderArray ??= _appenderList.ToArray();
foreach (IAppender appender in _appenderArray)Can you adjust the code? |
|
Yes of course, consistency can be very useful! Thank you. |
|
Hi @FreeAndNil - I had a look and I don't think the private I've removed it everywhere if that's ok? |
|
@tmct the _appenderArray had the advantage to copy the contents only once into an array. I'm currently considering switching to System.ComponentModel.Collections.Collection as base class. |
|
Ah yes you could be right, this could specifically have a performance impact in AppendLoopOnAppenders, being the method among these that we expect to be called frequently without a change in the list, the problem being the repeated filing of the same array. I can address that later today or Monday, thanks. |
|
@tmct Will you find the time to complete within this week? |
|
Hi @FreeAndNil, I'm not sure, sorry. I will try to though. Apologies - work became busy. |
|
Hi @tmct, hope you're doing well! Just checking in on this. Do you have an estimated timeframe for when this will be completed? Thanks. |
|
@tmct closing this for now, please reopen when you find time to complete. |
Hello,
We have been witnessing this error now and again while using log4net 2.0.15:
It looks like the code on master is still susceptible to this, what do you think of this change? (The try-catch should be wel-equipped to handle appenders that have left the List, so long as we can still access their name for the error message...)
Thanks,
Tom