Commit c20e6c98 authored by Jon Cole's avatar Jon Cole

Add ThreadPool statistics to Timeout message to help debug IOCP starvation issues.

parent dbec9ca5
......@@ -1817,6 +1817,8 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
.Append(", wr=").Append(wr).Append("/").Append(wq)
.Append(", in=").Append(@in).Append("/").Append(ar);
AppendThreadPoolStats(sb);
errMessage = sb.ToString();
if (stormLogThreshold >= 0 && queue >= stormLogThreshold && Interlocked.CompareExchange(ref haveStormLog, 1, 0) == 0)
{
......@@ -1839,6 +1841,27 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
}
}
private static void AppendThreadPoolStats(StringBuilder errorMessage)
{
//BusyThreads = TP.GetMaxThreads() –TP.GetAVailable();
//If BusyThreads >= TP.GetMinThreads(), then threadpool growth throttling is possible.
int maxIoThreads, maxWorkerThreads;
ThreadPool.GetMaxThreads(out maxWorkerThreads, out maxIoThreads);
int freeIoThreads, freeWorkerThreads;
ThreadPool.GetAvailableThreads(out freeWorkerThreads, out freeIoThreads);
int minIoThreads, minWorkerThreads;
ThreadPool.GetMinThreads(out minWorkerThreads, out minIoThreads);
int busyIoThreads = maxIoThreads - freeIoThreads;
int busyWorkerThreads = maxWorkerThreads - freeWorkerThreads;
errorMessage.AppendFormat(", IOCP:(Busy={0},Min={1},Max={2})", busyIoThreads, minIoThreads, maxIoThreads);
errorMessage.AppendFormat(", WORKER:(Busy={0},Min={1},Max={2})", busyWorkerThreads, minWorkerThreads, maxWorkerThreads);
}
/// <summary>
/// Should exceptions include identifiable details? (key names, additional .Data annotations)
/// </summary>
......
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