网站运行一段时间就挂掉

时间:2022-02-01 17:09:25
事件查看器的日志如下,排查过多线程的地方,已经全部加上trycatch记录日志了,并未拦截到异常 AsyncController也都重写OnException记录日志了 也未捕获到异常

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Web.Mvc.Async.SynchronousOperationException
Stack:
   at System.Web.Mvc.Async.SynchronizationContextUtil.Sync[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](System.Threading.SynchronizationContext, System.Func`1<System.Web.Mvc.Async.AsyncVoid>)
   at System.Web.Mvc.Async.SynchronizationContextUtil.Sync(System.Threading.SynchronizationContext, System.Action)
   at System.Web.Mvc.Async.AsyncUtil+<>c__DisplayClass2.<WrapCallbackForSynchronizedExecution>b__0(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ExecuteAsynchronousCallback(Boolean)
   at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].HandleAsynchronousCompletion(System.IAsyncResult)
   at System.Web.Mvc.Async.SimpleAsyncResult.MarkCompleted(Boolean, System.AsyncCallback)
   at System.Web.Mvc.Async.ReflectedAsyncActionDescriptor+<>c__DisplayClass7+<>c__DisplayClass9.<BeginExecute>b__4(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

6 个解决方案

#1





An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/6/ROOT

Process ID: 14076

Exception: System.Web.Mvc.Async.SynchronousOperationException

Message: 一个跨过同步上下文的操作失败。有关更多信息,请参见内部异常。

StackTrace:    at System.Web.Mvc.Async.SynchronizationContextUtil.Sync[T](SynchronizationContext syncContext, Func`1 func)
   at System.Web.Mvc.Async.SynchronizationContextUtil.Sync(SynchronizationContext syncContext, Action action)
   at System.Web.Mvc.Async.AsyncUtil.<>c__DisplayClass2.<WrapCallbackForSynchronizedExecution>b__0(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.SimpleAsyncResult.MarkCompleted(Boolean completedSynchronously, AsyncCallback callback)
   at System.Web.Mvc.Async.ReflectedAsyncActionDescriptor.<>c__DisplayClass7.<>c__DisplayClass9.<BeginExecute>b__4(Object _)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

InnerException: System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace:    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(Exception error)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
   at System.Web.Mvc.Async.AsyncUtil.<>c__DisplayClass2.<>c__DisplayClass5.<WrapCallbackForSynchronizedExecution>b__1()
   at System.Web.Mvc.Async.SynchronizationContextUtil.<>c__DisplayClass4.<Sync>b__3()
   at System.Web.Mvc.Async.SynchronizationContextUtil.<>c__DisplayClass1`1.<Sync>b__0(Object o)

#2


错误应用程序名称: w3wp.exe,版本: 7.5.7601.17514,时间戳: 0x4ce7a5f8
错误模块名称: KERNELBASE.dll,版本: 6.1.7601.23714,时间戳: 0x58bf87bb
异常代码: 0xe0434352
错误偏移量: 0x0000c54f
错误进程 ID: 0x36fc
错误应用程序启动时间: 0x01d3512883ec5467
错误应用程序路径: C:\Windows\SysWOW64\inetsrv\w3wp.exe
错误模块路径: C:\Windows\syswow64\KERNELBASE.dll
报告 ID: 0e268077-bd1c-11e7-81ed-a4badb25eb8e
错误程序包全名: %14
错误程序包相对应用程序 ID: %15

#3


这可能还是要看代码,
看异常貌似是牵涉到异步async await的问题。
这种错误要自己分析了。

#4


emmm 项目中并未使用到async await关键字 也没有用Task  多线程的地方都用的ThreadPool.QueueUserWorkItem  里面也全都加了异常处理记录日志了  发现问题是因为有段复杂逻辑在执行的时候无故中断,然后找不到错误日志,最后发现是应用程序池挂掉 才在事件查看器中发现这个错误  其他几个日志有触发异常的代码的堆栈信息,我已经加上异常处理了 然后就剩下这个异常 经常出现 又定位不到具体代码

#5


看到了Async QueueUserWorkItemCallback,只能自己查代码分析了

#6


是不是杀毒软件

#1





An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/6/ROOT

Process ID: 14076

Exception: System.Web.Mvc.Async.SynchronousOperationException

Message: 一个跨过同步上下文的操作失败。有关更多信息,请参见内部异常。

StackTrace:    at System.Web.Mvc.Async.SynchronizationContextUtil.Sync[T](SynchronizationContext syncContext, Func`1 func)
   at System.Web.Mvc.Async.SynchronizationContextUtil.Sync(SynchronizationContext syncContext, Action action)
   at System.Web.Mvc.Async.AsyncUtil.<>c__DisplayClass2.<WrapCallbackForSynchronizedExecution>b__0(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.ExecuteAsynchronousCallback(Boolean timedOut)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.HandleAsynchronousCompletion(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.SimpleAsyncResult.MarkCompleted(Boolean completedSynchronously, AsyncCallback callback)
   at System.Web.Mvc.Async.ReflectedAsyncActionDescriptor.<>c__DisplayClass7.<>c__DisplayClass9.<BeginExecute>b__4(Object _)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

InnerException: System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace:    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(Exception error)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
   at System.Web.Mvc.Async.AsyncUtil.<>c__DisplayClass2.<>c__DisplayClass5.<WrapCallbackForSynchronizedExecution>b__1()
   at System.Web.Mvc.Async.SynchronizationContextUtil.<>c__DisplayClass4.<Sync>b__3()
   at System.Web.Mvc.Async.SynchronizationContextUtil.<>c__DisplayClass1`1.<Sync>b__0(Object o)

#2


错误应用程序名称: w3wp.exe,版本: 7.5.7601.17514,时间戳: 0x4ce7a5f8
错误模块名称: KERNELBASE.dll,版本: 6.1.7601.23714,时间戳: 0x58bf87bb
异常代码: 0xe0434352
错误偏移量: 0x0000c54f
错误进程 ID: 0x36fc
错误应用程序启动时间: 0x01d3512883ec5467
错误应用程序路径: C:\Windows\SysWOW64\inetsrv\w3wp.exe
错误模块路径: C:\Windows\syswow64\KERNELBASE.dll
报告 ID: 0e268077-bd1c-11e7-81ed-a4badb25eb8e
错误程序包全名: %14
错误程序包相对应用程序 ID: %15

#3


这可能还是要看代码,
看异常貌似是牵涉到异步async await的问题。
这种错误要自己分析了。

#4


emmm 项目中并未使用到async await关键字 也没有用Task  多线程的地方都用的ThreadPool.QueueUserWorkItem  里面也全都加了异常处理记录日志了  发现问题是因为有段复杂逻辑在执行的时候无故中断,然后找不到错误日志,最后发现是应用程序池挂掉 才在事件查看器中发现这个错误  其他几个日志有触发异常的代码的堆栈信息,我已经加上异常处理了 然后就剩下这个异常 经常出现 又定位不到具体代码

#5


看到了Async QueueUserWorkItemCallback,只能自己查代码分析了

#6


是不是杀毒软件