Permalink
Browse files

Fixed handling of abandoned mutexes in MutexMultiProcessFileAppender

  • Loading branch information...
1 parent 8118b62 commit 44950420d8e3256efdb86471924deeab70e00bd5 @jkowalski committed Jul 24, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/NLog/Internal/FileAppenders/MutexMultiProcessFileAppender.cs
@@ -100,7 +100,17 @@ public override void Write(byte[] bytes)
return;
}
- this.mutex.WaitOne();
+ try
+ {
+ this.mutex.WaitOne();
+ }
+ catch (AbandonedMutexException)
+ {
+ // ignore the exception, another process was killed without properly releasing the mutex
+ // the mutex has been acquired, so proceed to writing
+ // See: http://msdn.microsoft.com/en-us/library/system.threading.abandonedmutexexception.aspx
+ }
+
try
{
this.file.Seek(0, SeekOrigin.End);

0 comments on commit 4495042

Please sign in to comment.