为什么进程会在 RtlExitUserProcess/LdrpDrainWorkQueue 中挂起? [英] Why would a process hang within RtlExitUserProcess/LdrpDrainWorkQueue?

查看:144
本文介绍了为什么进程会在 RtlExitUserProcess/LdrpDrainWorkQueue 中挂起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了调试锁定文件问题,我们从 .NET 进程调用 SysInternal 的 Handle64.exe 4.11(通过具有异步输出重定向的 Process.Start).调用进程挂在 Process.WaitForExit 上,因为 Handle64 进程没有退出(超过两个小时).

我们转储了相应的 Handle64 进程,并在 Visual Studio 2017 调试器中进行了检查.它显示了两个线程(主线程"和ntdll.dll!TppWorkerThread").

主线程的调用栈:

<块引用>

ntdll.dll!NtWaitForSingleObject () 未知ntdll.dll!LdrpDrainWorkQueue() 未知ntdll.dll!RtlExitUserProcess() 未知kernel32.dll!ExitProcessImplementation () 未知handle64.exe!000000014000664c() 未知handle64.exe!00000001400082a5() 未知kernel32.dll!BaseThreadInitThunk () 未知ntdll.dll!RtlUserThreadStart () 未知

工作线程的调用栈:

<块引用>

ntdll.dll!NtWaitForSingleObject() 未知ntdll.dll!LdrpDrainWorkQueue() 未知ntdll.dll!LdrpInitializeThread() 未知ntdll.dll!_LdrpInitialize() 未知ntdll.dll!LdrInitializeThunk() 未知

我的问题是:为什么一个进程会在 LdrpDrainWorkQueue 中挂起?从 https://stackoverflow.com/a/42789684/62838,我认为这是 Windows 10 并行加载器工作,但为什么退出进程时会卡住?这可能是由我们如何从另一个进程调用 Handle64 引起的吗?即,我们做错了什么还是 Handle64 中的一个错误?

解决方案

你等了多久?

根据此分析

<块引用>

工作线程空闲超时设置为 30 秒.程序在不到 30 秒内执行会出现挂起ntdll!TppWorkerThread 在进程之前等待空闲超时终止.

我建议尝试设置该文章中指定的注册表项以禁用并行加载程序,看看是否能解决问题.

Parent Key: HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\handle64.exe值名称:MaxLoaderThreads类型:双字值:1 禁用

To debug a locked file problem, we're calling SysInternal's Handle64.exe 4.11 from a .NET process (via Process.Start with asynchronous output redirection). The calling process hangs on Process.WaitForExit because the Handle64 process doesn't exit (for more than two hours).

We took a dump of the corresponding Handle64 process and checked it in the Visual Studio 2017 debugger. It shows two threads ("Main Thread" and "ntdll.dll!TppWorkerThread").

Main thread's call stack:

ntdll.dll!NtWaitForSingleObject ()  Unknown
ntdll.dll!LdrpDrainWorkQueue()  Unknown
ntdll.dll!RtlExitUserProcess()  Unknown
kernel32.dll!ExitProcessImplementation  ()  Unknown
handle64.exe!000000014000664c() Unknown
handle64.exe!00000001400082a5() Unknown
kernel32.dll!BaseThreadInitThunk    ()  Unknown
ntdll.dll!RtlUserThreadStart    ()  Unknown

Worker thread's call stack:

ntdll.dll!NtWaitForSingleObject()   Unknown
ntdll.dll!LdrpDrainWorkQueue()  Unknown
ntdll.dll!LdrpInitializeThread()    Unknown
ntdll.dll!_LdrpInitialize() Unknown
ntdll.dll!LdrInitializeThunk()  Unknown

My question is: Why would a process hang in LdrpDrainWorkQueue? From https://stackoverflow.com/a/42789684/62838, I gather that this is the Windows 10 parallel loader at work, but why would it get stuck while exiting the process? Can this be caused by how we invoke Handle64 from another process? I.e., are we doing something wrong or is this rather a bug in Handle64?

解决方案

How long did you wait?

According to this analysis,

The worker thread idle timeout is set to 30 seconds. Programs which execute in less than 30 seconds will appear to hang due to ntdll!TppWorkerThread waiting for the idle timeout before the process terminates.

I would recommend trying to set the registry key specified in that article to disable the parallel loader and see if this resolved the issue.

Parent Key: HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\handle64.exe
Value Name: MaxLoaderThreads
Type: DWORD
Value: 1 to disable

这篇关于为什么进程会在 RtlExitUserProcess/LdrpDrainWorkQueue 中挂起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆