Lock contention is found in our service
We are using "StackExchange.Redis" version="2.0.601". Found AwareLock::Contention in different APIs. I have read the blog https://blog.marcgravell.com/2019/02/fun-with-spiral-of-death.html and checked our code. Besides this blog, what other clues I can start to investigate this issue?
-
clr.dll!AwareLock::Contention clr.dll!Monitor.Contention (Lock) Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler!Schedule System.IO.Pipelines.Pipe!FlushAsync System.IO.Pipelines.Pipe+DefaultPipeWriter!FlushAsync StackExchange.Redis.PhysicalConnection!FlushAsync StackExchange.Redis.PhysicalBridge!WriteMessageTakingWriteLockAsync StackExchange.Redis.PhysicalBridge!TryWriteAsync StackExchange.Redis.ServerEndPoint!TryWriteAsync StackExchange.Redis.ConnectionMultiplexer!ExecuteAsyncImpl StackExchange.Redis.RedisBase!ExecuteAsync StackExchange.Redis.RedisDatabase!KeyTimeToLiveAsync Micrsoft.ActivityService.CacheClient.Redis.LocalRedisService+
d__15!MoveNext LocalRedisService Redis CacheClient ActivityService Async/Task Calls by Namespace All Stacks (Inclusive Time Merged) -
clr.dll!AwareLock::Contention clr.dll!Monitor.Contention (Lock) Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler!Schedule System.IO.Pipelines.Pipe!FlushAsync System.IO.Pipelines.Pipe+DefaultPipeWriter!FlushAsync StackExchange.Redis.PhysicalConnection!FlushAsync StackExchange.Redis.PhysicalBridge!WriteMessageTakingWriteLockAsync StackExchange.Redis.PhysicalBridge!TryWriteAsync StackExchange.Redis.ServerEndPoint!TryWriteAsync StackExchange.Redis.ConnectionMultiplexer!ExecuteAsyncImpl StackExchange.Redis.RedisBase!ExecuteAsync StackExchange.Redis.RedisDatabase!StringDecrementAsync Microsoft.ActivityService.CacheClient.Redis.LocalRedisService+
d__12!MoveNext LocalRedisService Redis CacheClient ActivityService Microsoft Async/Task Calls by Namespace All Stacks (Inclusive Time Merged)
3.clr.dll!AwareLock::Contention
clr.dll!Monitor.Contention (Lock)
Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler!Schedule
System.IO.Pipelines.Pipe!FlushAsync
System.IO.Pipelines.Pipe+DefaultPipeWriter!FlushAsync
StackExchange.Redis.PhysicalConnection!FlushAsync
StackExchange.Redis.PhysicalBridge!WriteMessageTakingWriteLockAsync
StackExchange.Redis.PhysicalBridge!TryWriteAsync
StackExchange.Redis.ServerEndPoint!TryWriteAsync
StackExchange.Redis.ConnectionMultiplexer!ExecuteAsyncImpl
StackExchange.Redis.RedisBase!ExecuteAsync
StackExchange.Redis.RedisDatabase!StringGetAsync
Microsoft.ActivityService.CacheClient.Redis.LocalRedisService+
- clr.dll!AwareLock::Contention
clr.dll!Monitor.Contention (Lock)
Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler!Schedule
System.IO.Pipelines.Pipe!FlushAsync
System.IO.Pipelines.Pipe+DefaultPipeWriter!FlushAsync
StackExchange.Redis.PhysicalConnection!FlushAsync
StackExchange.Redis.PhysicalBridge!WriteMessageTakingWriteLockAsync
StackExchange.Redis.PhysicalBridge!TryWriteAsync
StackExchange.Redis.ServerEndPoint!TryWriteAsync
StackExchange.Redis.ConnectionMultiplexer!ExecuteAsyncImpl
StackExchange.Redis.RedisBase!ExecuteAsync
Microsoft.ActivityService.CacheClient.Redis.LocalRedisService+
d__11!MoveNext LocalRedisService Redis CacheClient ActivityService Microsoft Async/Task Calls by Namespace All Stacks (Inclusive Time Merged)
The fact that the various threads are using a shared lock to coordinate their efforts isn't an issue to investigate in this case - it's a proper use of the mechanism and expect behavior :) Think of it this way: the threads are all active, they have to be somewhere in their stacks, you're seeing this particular spot.
Closing this out just to cleanup since this is behaving as it should :)