mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5337
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5185
Author: @XiaoBinGan
Created: 11/4/2026
Status: 🔄 Open
Base:
main← Head:reserve/fix-host-platform-wmi📝 Commits (1)
aa14ef9[Other] Control: host_platform() asks no WMI on Windows, so a stuck winmgmt cannot hang it (#4975)📊 Changes
3 files changed (+90 additions, -4 deletions)
View changed files
📝
strata_control/targets.py(+25 -3)➕
tests/terminal/test_host_platform.py(+58 -0)📝
tests/terminal/test_linux_aarch64.py(+7 -1)📄 Description
Problem and result
On Windows,
strata_control/targets.py:host_platform()asked the OS throughplatform.system()andplatform.machine(). Both areplatform.uname()on Windows, and on the bundled Python 3.12uname()callswin32_ver()→platform._wmi_query(): a WMI query with no timeout. When the Windows ManagementInstrumentation service (
winmgmt) is stuck, every Control command that resolves an engine component hangs for aslong as WMI does — the report shows the app's «Strata Control did not answer within 60 s (models list)», no supported
GPU and nothing loadable, while
nvidia-smianswers in 0.08 s.After the change the OS and architecture are answered without WMI:
sys.platformis set by the interpreter, andPROCESSOR_ARCHITEW6432/PROCESSOR_ARCHITECTUREare exactly thevariables
platform.uname()itself reads on Windows (platform._get_machine_win32()), so the answers are unchanged:windows-x86_64(AMD64),windows-arm64(ARM64).Related discussion
#4975 — the report, with the
faulthandlerstack insideplatform._wmi_queryand the note that the same code is onmain(strata_control/targets.py:33,:36). No separate scope agreement was asked for: a stuck WMI taking the appdown is the bug, and the reporter suggests the same fix (use
sys.platform/ thePROCESSOR_*variables instead ofplatform.uname()).Approach
_system_name(): on Windows the name is"Windows"without askingplatform; every other system keepsplatform.system()(that asks the kernel there, not a service)._machine_name(): on Windows it readsPROCESSOR_ARCHITEW6432thenPROCESSOR_ARCHITECTURE(the same twovariables CPython's
platform.uname()reads on Windows,PROCESSOR_ARCHITEW6432first because a 32-bit processmasks the native architecture); every other system keeps
platform.machine().host_platform()maps the two names exactly as before, so no returnedos-archkey changes.platform.system/platform.machine(
tests/terminal/test_linux_aarch64.py::host()) now also stubssys.platformand the architecture variable for itsWindows row, because that is the source the Windows path reads.
Validation
Passed: the regression test — new file
tests/terminal/test_host_platform.py(4 tests, 12 subtests). It makesevery
platformcall the old Windows path made fail withAssertionError("WMI is stuck")(a real hang cannot beproduced from a test) and asserts the answers still come back:
Passed: the surrounding Control tests, on this checkout (Windows 11, Python 3.11.16):
Passed: the A/B — with
strata_control/targets.pyreverted tomain, the new test fails with the WMI calls:With the fix the same file is 4 passed, and the real host still answers
windows-x86_64(thetest_the_answer_is_a_key_of_the_backend_matrixcase).Failed: none.
Not run: a real WMI stall — the service cannot be stuck on demand, and this box is Python 3.11, whose
win32_ver()does not use WMI (the 3.12_wmi_querypath is the reporter's stack in #4975). The evidence that theold code makes that call is the CPython source:
platform.system()/platform.machine()→platform.uname()→win32_ver(), which in 3.12 calls_wmi_query(); the test pins that neither call is made on Windows. A realWindows-3.12 run against a stuck
winmgmtremains for the maintainers.Limits
PROCESSOR_*variables, the same source CPython uses; if anenvironment stripped both, the answer would be
windows-as it would be empty inplatform.uname()too (notobserved).
platform.system()is still used on macOS and Linux, where it is a syscall. If a future platform'splatformmodule starts calling a service, this function would need the same treatment there.
platformis still imported for the other systems; no other caller ofhost_platform()changes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.