Skip to content

Return every process instead of stopping at 1024 - #101

Open
Johnny Hunter (hackyhunter) wants to merge 1 commit into
microsoft:mainfrom
hackyhunter:fix-process-list-limit
Open

Johnny Hunter (hackyhunter) wants to merge 1 commit into
microsoft:mainfrom
hackyhunter:fix-process-list-limit

Conversation

@hackyhunter

Copy link
Copy Markdown

Fixes #100

GetRawProcessList stopped after 1024 processes. The limit was there to protect the fixed-size process_info array (592c945, #9). Since #67, the list is a std::vector that grows with push_back, so the limit no longer guards against anything. It only drops processes, and the ones it drops are the newest. This change removes it.

Testing

On Windows 11 with Node 22:

  • With 1160 processes running, 100 of them ping.exe processes started just before the call:
    • 0.8.0 returned 1024 processes and found 34 of the pings.
    • This change returns 1160 processes and finds all 100.
  • npm test passes, 32 tests, in each of 3 runs.

The limit itself has no automated test, because exercising it needs more than 1024 live processes on the runner.

GetRawProcessList stopped reading the toolhelp snapshot after 1024 processes. The limit protected the fixed-size process_info array (592c945, microsoft#9). Since microsoft#67 the list is a std::vector that grows with push_back, so the limit no longer prevents an overflow and only drops processes. The snapshot lists them in creation order, so the ones dropped are the newest: a process the caller just started and its children.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Process lists silently stop at 1024 processes

1 participant