New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lock conflicts occur when multiple sites (with ExceptionLess.net) are deployed on a server #305
Conversation
… are deployed on a server
if (_flushMutex != null) { | ||
_flushMutex.Close(); | ||
_flushMutex = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this, I don't see how it can hurt.
#if NET45 | ||
var security = new MutexSecurity(); | ||
var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow); | ||
security.AddAccessRule(allowEveryoneRule); | ||
|
||
string name = GetFileBasedMutexName(fileNameOrPath); | ||
|
||
try { | ||
return new Mutex(false, name, out bool _, security); | ||
} catch (Exception ex) { | ||
if (ex is SecurityException || ex is UnauthorizedAccessException || ex is NotSupportedException || ex is NotImplementedException) { | ||
System.Diagnostics.Trace.WriteLine("Exceptionless: Error creating global mutex falling back to previous implementation: {0}", ex.ToString()); | ||
return new Mutex(false, nameof(FileExceptionlessLog)); | ||
} | ||
|
||
System.Diagnostics.Trace.WriteLine("Exceptionless: Error creating global mutex: {0}", ex.ToString()); | ||
throw; | ||
} | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global mutexes are not supported on .NET Core or mono. There probably is a case we don't fully cover here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs they are when the mutex name starts with Global\ which you are doing.
Addresses #257