Commit 11be4b51 authored by Marc Gravell's avatar Marc Gravell Committed by GitHub

Merge pull request #505 from JonCole/cpuConnectFailure

Add ThreadPool and CPU summary to connection related errors.
parents 92d5626d 16df9046
...@@ -2078,6 +2078,14 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser ...@@ -2078,6 +2078,14 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
} }
#if !CORE_CLR #if !CORE_CLR
internal static string GetThreadPoolAndCPUSummary()
{
string iocp, worker;
GetThreadPoolStats(out iocp, out worker);
var cpu = GetSystemCpuPercent();
return $"IOCP: {iocp}, WORKER: {worker}, Local-CPU: {cpu}";
}
private static string GetSystemCpuPercent() private static string GetSystemCpuPercent()
{ {
float systemCPU; float systemCPU;
......
...@@ -86,6 +86,13 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand ...@@ -86,6 +86,13 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand
serverSnapshot = new ServerEndPoint[] { server }; serverSnapshot = new ServerEndPoint[] { server };
} }
string exceptionmessage = "No connection is available to service this operation: " + s ; string exceptionmessage = "No connection is available to service this operation: " + s ;
#if !CORE_CLR
if (includeDetail)
{
exceptionmessage += ". " + ConnectionMultiplexer.GetThreadPoolAndCPUSummary();
}
#endif
var ex = new RedisConnectionException(ConnectionFailureType.UnableToResolvePhysicalConnection, exceptionmessage, GetServerSnapshotInnerExceptions(serverSnapshot)); var ex = new RedisConnectionException(ConnectionFailureType.UnableToResolvePhysicalConnection, exceptionmessage, GetServerSnapshotInnerExceptions(serverSnapshot));
if (includeDetail) if (includeDetail)
{ {
......
...@@ -164,7 +164,10 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -164,7 +164,10 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
} }
else else
{ {
err = string.Format("Endpoint {0} serving hashslot {1} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect.", endpoint, hashSlot); err = string.Format("Endpoint {0} serving hashslot {1} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. ", endpoint, hashSlot);
#if !CORE_CLR
err += ConnectionMultiplexer.GetThreadPoolAndCPUSummary();
#endif
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment