Fatal exception, how to catch? System.Net.InternalException: system error

System.Net.InternalException: System error. at System.Net.HttpWebRequest.CheckWriteSideResponseProcessing() at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult retur nResult) at System.Net.HttpWebRequest.WriteCallDone(ConnectStream stream, ConnectionRe turnResult returnResult) at System.Net.ConnectStream.CallDone(ConnectionReturnResult returnResult) at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean abort ing) at System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(CloseExState closeSta te) at System.Net.ConnectStream.CloseInternal(Boolean internalCall) at System.Net.HttpWebRequest.EndWriteHeaders_Part2() at System.Net.HttpWebRequest.EndWriteHeaders(Boolean async) at System.Net.HttpWebRequest.WriteHeadersCallback(WebExceptionStatus errorSta tus, ConnectStream stream, Boolean async) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) at System.Net.LazyAsyncResult.Complete(IntPtr userToken) at System.Net.ContextAwareResult.Complete(IntPtr userToken) at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr u serToken) at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 

This was discovered by an unhandled exception handler. This happens only occasionally, but with disastrous results. Any ideas how to actually catch this person?

UPDATE

Now it has become apparent that this only happens when the CPU is under exceptionally high load.

+4
source share
3 answers

If this exception throws itself at the I / O completion thread, mostly without any intervention from you, then I would be inclined to open the ticket using Microsoft Connect . Reasoning: you run an asynchronous I / O operation, which apparently throws an exception due to a dropped connection that belongs to it in the thread pool that you cannot catch. This means that there is a possibility that a lost connection during an asynchronous operation will lead to the removal of the application, and there is nothing you can do about it. Sounds like a structure error to me.

A temporary workaround may be to place <legacyUnhandledExceptionPolicy enabled="1"/> in the <runtime> section of your application configuration file. This will return to the behavior of .NET 1.0 / 1.1, where exceptions thrown on a different thread than the main thread will not cancel the application. See Also: http://msdn.microsoft.com/en-us/library/ms228965.aspx

+4
source

We had the same problem and managed to get help from Microsoft. For us, this was caused by the race condition in the winsock api, caused by the fact that we disabled the Nagle algorithm. You might want to check out my blog post if you find yourself in the same situation: ASP.NET Serialization Exception Crash, winsock, and Nagle Algorithm .

+3
source

It looks like you have a dropped connection. This will be especially true if you use Async calls. Every time you try to access an object when you delete a connection, you get this error. Here is an SO article that has a little more about it:

What is this mistake? System.Net.InternalException in Net.HttpWebRequest.SetAndOrProcessResponse

-1
source

All Articles