Skip to content

PerformanceCounters causes hang #587

@AlexanderKot

Description

@AlexanderKot

Hello
I am using StackExchange.Redis with NHibernate.Caches.Redis
I have experimented with behavior of our system if it will loose connection with Redis (lunch application and then stop Redis server).
On my environment (w7x64, Vs 2015U3, IIS Express 10.0.14358, .Net 4.6) I have stable hang on accessing PerformanceCounter when preparing exception after connection was lost.
After this happens IISExpress is locked and do not accept new requests.

I cannot reproduce the same behavior on my colleagues PCs.
I have found similar bugs:
Particular/NServiceBus#2047
SignalR/SignalR#3414

I have tried solution used in SignalR:
SignalR/SignalR@23e5b1b
I have added EnsureValidCulture() method to StackExchange.Redis and call it in TryGetSystemCPU method.
Unfortunately, it does not help.

There exists workaround currently:
ConnectionMultiplexer.IncludeDetailInExceptions must be false
This flag is set true by default.

Do somebody has any ideas?

PS
Part of call stack from my environment:
[Managed to Native Transition]
mscorlib.dll!Microsoft.Win32.RegistryKey.InternalGetValue(string name, object defaultValue, bool doNotExpand, bool checkSecurity) Unknown
mscorlib.dll!Microsoft.Win32.RegistryKey.GetValue(string name) Unknown
System.dll!System.Diagnostics.PerformanceMonitor.GetData(string item) Unknown
System.dll!System.Diagnostics.PerformanceCounterLib.GetPerformanceData(string item) Unknown
System.dll!System.Diagnostics.PerformanceCounterLib.CategoryTable.get() Unknown
System.dll!System.Diagnostics.PerformanceCounterLib.CounterExists(string category, string counter, ref bool categoryExists) Unknown
System.dll!System.Diagnostics.PerformanceCounterLib.CounterExists(string machine, string category, string counter) Unknown
System.dll!System.Diagnostics.PerformanceCounter.InitializeImpl() Unknown
System.dll!System.Diagnostics.PerformanceCounter.PerformanceCounter(string categoryName, string counterName, string instanceName, bool readOnly) Unknown
System.dll!System.Diagnostics.PerformanceCounter.PerformanceCounter(string categoryName, string counterName, string instanceName) Unknown

StackExchange.Redis.dll!StackExchange.Redis.PerfCounterHelper.TryGetSystemCPU(out float value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions