.Net Server Crash

One of our customers reported a crash of their .Net server last night. This was running as a service on Win 2008R2. Nothing was caught by our own exception handling but from the event log we were able to get this:

Application: QUICService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Exception
Stack:
at RemObjects.SDK.ThreadPool.QueueItem(RemObjects.SDK.ThreadPoolCallback)
at RemObjects.SDK.Server.SCServerWorker.IncomingEvent(RemObjects.SDK.Server.IMessageQueue, System.IO.Stream)
at RemObjects.SDK.Server.SCServerWorker.HaveGuid()
at RemObjects.SDK.SuperTcpChannelWorker.CbServerWelcome(System.IAsyncResult)
at RemObjects.InternetPack.Connection.IntReadCallback(System.IAsyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr)
at System.Net.ContextAwareResult.CompleteCallback(System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Net.ContextAwareResult.Complete(IntPtr)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

Any suggestion what the issue could be? Is it something we’re doing wrong or a fault in RO SDK itself? We’re using the latest release (6.0.57.991)

Many thanks,
Kenny

Hello Kenny,

Looks like the number of simultaneous requests has gone beyond the default limits. We have logged an issue to fix the behavior, the server must not crash of course:
55686: Dangerous exception thrown in ThreadPool.QueueItem

You need to raise the thread pool limits. It is controlled by ThreadPool object accessible with ThreadPool property of the server channel. Normally this object is created automatically when the first request is about to be processed. But you need to create it yourself somewhere before the channel is activated and set the limits like this:

/* Assuming SuperTcpServerChannel serverChannel; */
serverChannel.ThreadPool = new RemObjects.SDK.ThreadPool();
/* The actual values below depend on the expected load */
serverChannel.ThreadPool.MaxThread = 100;
serverChannel.ThreadPool.MaxQueue = 10000;
serverChannel.ThreadPool.PoolThreads = 100;

Best regards - Sergey.

Many thanks Sergey, that would make sense as I understand the system was being hit by a large number of requests at the time. I’ll increase the limit in our code and look forward to the fix in due course.

Cheers,
Kenny