Skip to content

Use powershell if handle.exe is missing or reports an error #6613

@lukebakken

Description

@lukebakken

Related issues:

The issue is that, for some Windows users, handle.exe sometimes does not output the data line starting with File that the stats monitor expects. We have no idea why this happens, and have not been able to reproduce it. However, you can use Powershell to get the total number of handles for a process, which should be a "good enough" fallback.

Here is the output of each command on Windows 11, while I have PerfTest running with 10 consumers and producers:

(rabbit@bakkenl-z01)12> string:tokens(os:cmd("handle.exe /accepteula /nobanner /s /p " ++ os:getpid()), "\r\n"). ["Handle type summary:"," <Unknown type> : 2", " <Unknown type> : 119"," ALPC Port : 8", " Desktop : 1"," Directory : 2", " Event : 158"," File : 62", " IoCompletion : 18"," IoCompletionReserve: 1", " IRTimer : 6"," Key : 17", " Mutant : 2"," Process : 3", " Section : 3"," Semaphore : 8", " Thread : 23"," TpWorkerFactory : 3", " WaitCompletionPacket: 15"," WindowStation : 2", "Total handles: 453"] (rabbit@bakkenl-z01)13> os:cmd("pwsh.exe -NoLogo -NoProfile -NonInteractive -Command (Get-Process -Id " ++ os:getpid() ++ ").Handles"). "453\r\n 

When connections increase, the File count goes up (as expected) as do a couple others. But, it is linear, and gives a useful stat. Since the statistic is not used for alarms or rate-limiting RabbitMQ using this as a fallback seems reasonable.

@michaelklishin - thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions