ptv-logistics/Log4ALA

Method SerializeLoggingEvent is causing deadlocks because of IDictionary

Closed this issue · 1 comments

We are using Log4ALA to send 10,000,000 logs to log analytics every day. We have seen a lot of threads getting deadlock and we took a process dump to analyze what might be causing the issue.

We have identified that this method SerializeLoggingEvent is causing deadlocks because it should use a ConcurrentDictionary instead of an IDictionary. The variable created inside this method is being passed to other methods so the type of the variable should be changed in all classes.

I am adding a screenshot of a dump that shows the problem. I am omitting data from it because of my company policy to not show sensitive information.

deadlock

Hello Rafael,

can you please attach a screenshot of the exception...I can't see any in your screenshot there is only a .NET Call Stack...by the way in this case the IDictionary interface will be implemented by the ExpandoObject which in my opinion is threadsafe please have a more detailed look at the implementation of ExpandoObject IDictionary.Add implementation which calls TryAddMember which in turn calls TrySetValue and this method uses a threadsafe lock...