The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
koger
 |
|
Reineri, Jim
 |
| 12/05/2008 2:47 PM |
|
This is the situation described in Coding Horror: On thread #1, our code was doing Log (lock) / DB stuff (lock) On thread #2, our code was doing DB stuff (lock) / log stuff (lock)
The is a classic deadlock example. If thread #1 locks 'Log' at the same time that thread #2 locks 'DB Stuff' then thread #1 will be waiting for the 'DB stuff' lock to be freed before it can complete its work and thread #2 will be waiting for the 'Log' lock to be freed before completing its work. Because each is waiting on the other, neither will ever release its lock.
It is more likely to occur on heavily loaded, multi-core systems.
This problem is easily avoided by making sure that any code that needs both resources applies the locks in the same order.
As was pointed out in the article, the problem was not a problem with log4net. It really is not a even problem with logging. The problem was really bad code.
The author does make some good points about logging. While I do not necessarily agree with everything he said, it is worth a read.
Cheers, Jim
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|