mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
On Windows with Python 3.12, platform.system() / uname() ask WMI through _wmi.exec_query. truststore, imported by strata_control/tls.py, calls
platform.system() at import, in the runtime host's start-up thread. When WMI refuses the account (HRESULT 0x80041003, a standard user over an ssh
logon on the Strix test box) the query takes about 5 s; exec_query gives up after 100 ms and returns, the start-up thread ends and its stack goes
away, and the late worker thread reads its struct on that dead stack: an access violation at _wmi.pyd+0x1640 that ends the host (exit 0xC0000005),
and the kill-on-close job takes the server and the engine with it. "The server could not start: runtime control is unavailable; inspect the private
host log." Found with a scratch vectored-exception tracer on Strix (faulting thread start address _wmi.pyd+0x10b0, Rbx = 0x80041003).
Fix: every Strata entry point puts `sys.modules["_wmi"] = None` first (Windows only), so platform falls back to the registry, `ver` and the
environment, as it did before Python 3.12 (same answers: system, release, version, machine, processor, platform, win32_ver, checked).
- strata.py, setup.py, ref/load.py, serve/{server,mcp,cpu_affinity}.py, strata_control/{runtime,management,pictures,app_policy,tls}.py and the
tools the bundle runs (strata_mcp, iq_pack, strata_pack, pack_index, mtp_fetch, mtp_pack, mtp_rt, draft_vocab, strata_tokenizer, calibrate,
nvfp4_local_pack, strata_bench, strata_inspect, dflash2_pack, gguf_reader), plus the __init__ of strata_control, serve and strata_cli (the
first thing a `python -m` entry imports).
- sysinfo.block_wmi(): the second guard for a process whose platform module was imported earlier; tls.install() calls it before truststore. It
replaces platform._wmi_query (setting platform._wmi to None would raise AttributeError, which platform does not handle).
- package_terminal.add_sitecustomize(): the bundle's site-packages/sitecustomize.py carries the same line, for every process of the bundled python.
- tests/terminal/test_wmi_guard.py: each shipped entry file and package starts with the guard (a new entry point without it fails); on Windows each
entry module imported in a fresh process never loads _wmi and platform.system() is still "Windows"; block_wmi / tls / sitecustomize unit tests.
No user-visible text changes.