简体   繁体   English

ASP.NET核心应用程序在NtWaitForSingleObject中挂起了16000多个线程 - 它们在做什么?

[英]ASP.NET Core Application hangs with 16000+ Threads in NtWaitForSingleObject - What are they doing?

We have a ASP.NET Core 2.1 application in production which sometimes (from once a day to every two or three days) hangs and serves no more request. 我们有一个ASP.NET Core 2.1应用程序正在生产中, 有时 (每天一次,每两天或三天)挂起并不再提供请求。 This results in 502 Errors from the IIS which is placed in front. 这导致来自IIS的502错误放在前面。 Only option to get things working again seems to restart the application. 只有让事情再次起作用的选项似乎重启了应用程序。

When examining a memory dump with WinDbg, we noticed that almost all of our threads (we pushed the min number of Threadpool threads) have a rather small stack trace and are stuck in WaitForSingleObject and not somewhere in our application code. 在使用WinDbg检查内存转储时,我们注意到几乎所有的线程(我们推送最少数量的Threadpool线程)都有一个相当小的堆栈跟踪并且卡在WaitForSingleObject中而不是我们的应用程序代码中的某个位置。 The output was generated using the WinDbg command !mex.us . 输出是使用WinDbg命令生成的!mex.us

16352 threads [stats]: 27 29 37 38 39 40 41 42 43 44 ...
    00007ff898d85b84 ntdll!NtWaitForSingleObject+0x14
    00007ff895e93eef KERNELBASE!WaitForSingleObjectEx+0x8f
    00007ff885a1826a clr!CLRSemaphore::Wait+0x8a
    00007ff885a190cf clr!ThreadpoolMgr::UnfairSemaphore::Wait+0x115
    00007ff885a1927f clr!ThreadpoolMgr::WorkerThreadStart+0x28b
    00007ff885ac5abf clr!Thread::intermediateThreadProc+0x86
    00007ff8982f84d4 kernel32!BaseThreadInitThunk+0x14
    00007ff898d4e851 ntdll!RtlUserThreadStart+0x21

Are these threads actively waiting for other things to happen or are they done with their work and just in idle, waiting for new things to do? 这些线程是否在积极地等待其他事情发生,或者它们是否完成了他们的工作而只是闲置,等待新的事情要做?

If the first assumption is correct (which would explain the hanging application), why does the stack trace not point to the original call they are waiting for? 如果第一个假设是正确的(这可以解释挂起的应用程序),为什么堆栈跟踪不指向他们正在等待的原始调用?

具有该堆栈的线程正在等待工作,并且可能没有兴趣找到您的挂起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM