BaseTools/Source/C/Makefiles: Detect cycle in pids

Update _get_win32_parent_processes() to detect a
cycle in parent process ids that can cause
_get_win32_parent_processes() to never return.

If a pid cycle is detected, then return the list
of parent process ids detected up to the point
the cycle is detected.

GitHub Actions builds using windows-2025 can
reproduce this issue once in a while. It shows
up as job that runs until a timeout. If the job
is canceled, the logs show a python stack in the
loop in _get_win32_parent_processes().

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2026-01-01 12:50:52 -08:00 committed by mergify[bot]
parent a0002ddc53
commit f26760f5e2

View file

@ -171,7 +171,11 @@ def _get_win32_parent_processes():
pid = GetCurrentProcessId()
parent_processes = []
found_parent = True
seen_pids = set()
while found_parent:
if pid in seen_pids:
break
seen_pids.add(pid)
found_parent = False
for process in process_list:
if process.process_id == pid: