win-ci: 조사 2 (winrt msvcp140 순서), ffmpeg 없으면 테스트 건너뜀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 02:14:18 +09:00
parent 08de94e85f
commit 47fd237baf
2 changed files with 20 additions and 44 deletions

View File

@@ -1,48 +1,18 @@
"""Windows 에서 워커가 모델 적재 중 조용히 죽는 원인 조사."""
"""Windows 워커 크래시 원인 조사 2: winrt 가 자체 msvcp140.dll 을 먼저 올리면 onnxruntime/ctranslate2 가 죽는가."""
import glob
import os
import subprocess
import sys
CODE = r'''
import faulthandler, sys, os
faulthandler.enable()
print("python", sys.version, flush=True)
import ctranslate2
print("ct2", ctranslate2.__version__, "cuda devices", ctranslate2.get_cuda_device_count(), flush=True)
print("cpu compute types", ctranslate2.get_supported_compute_types("cpu"), flush=True)
from faster_whisper import WhisperModel
m = WhisperModel(os.environ["M"], device="cpu", compute_type=os.environ.get("CT", "int8"), cpu_threads=2)
print("LOAD OK", flush=True)
segs, info = m.transcribe(os.environ["A"], language="ko")
print("TEXT", "".join(s.text for s in segs), flush=True)
'''
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
audio = os.path.join(root, "app", "resources", "diag", "speech_ko.ogg")
model = None
for base in [os.environ.get("TEMP", ""), os.path.expanduser("~")]:
for dp, dn, fn in os.walk(base):
if "model.bin" in fn and dp.rstrip("\\/").endswith("tiny"):
model = dp
break
if dp.count(os.sep) - base.count(os.sep) > 4:
dn[:] = []
if model:
break
print("model dir", model, flush=True)
# onnxruntime 단독 / 다른 패키지 뒤 import, MSVC 런타임 버전
for code in ["import onnxruntime; print('ort', onnxruntime.__version__)",
"import av, ctranslate2; import onnxruntime; print('ort after av+ct2 ok')",
"import onnxruntime, av, ctranslate2; print('ort first ok')"]:
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", code], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300)
print(f"--- {code} -> exit {p.returncode} (0x{p.returncode & 0xffffffff:08X})", p.stdout.strip()[-300:], p.stderr.strip()[-800:], flush=True)
ps = "foreach ($f in 'msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll') { $p = Join-Path $env:WINDIR ('System32\\' + $f); if (Test-Path $p) { $f + ' ' + (Get-Item $p).VersionInfo.FileVersion } else { $f + ' 없음' } }"
print(subprocess.run(["powershell", "-NoProfile", "-Command", ps], capture_output=True, text=True).stdout, flush=True)
import glob
for f in glob.glob(os.path.join(sys.prefix, "Lib", "site-packages", "**", "msvcp140*.dll"), recursive=True):
print("bundled", f, flush=True)
for env in [{}, {"KMP_DUPLICATE_LIB_OK": "TRUE"}, {"CT": "float32"}, {"OMP_NUM_THREADS": "1", "CT": "float32"}]:
e = {**os.environ, "M": model or "tiny", "A": audio, **env}
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", CODE], env=e, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=600)
print(f"=== env={env} exit={p.returncode} (0x{p.returncode & 0xffffffff:08X})", flush=True)
print(p.stdout[-1500:], flush=True)
print("stderr:", p.stderr[-2500:], flush=True)
sp = os.path.join(sys.prefix, "Lib", "site-packages")
for f in glob.glob(os.path.join(sp, "**", "msvcp140*.dll"), recursive=True) + glob.glob(os.path.join(sp, "**", "vcruntime140*.dll"), recursive=True):
v = subprocess.run(["powershell", "-NoProfile", "-Command", f"(Get-Item '{f}').VersionInfo.FileVersion"], capture_output=True, text=True).stdout.strip()
print("bundled", f.replace(sp, "site-packages"), v, flush=True)
for code in [
"import winrt.windows.media.ocr; import onnxruntime; print('winrt then ort ok')",
"import winrt.windows.media.ocr; import ctranslate2; print('winrt then ct2 ok')",
"import onnxruntime, ctranslate2; import winrt.windows.media.ocr; print('ort,ct2 then winrt ok')",
"import gvr_worker.ocr as o; import onnxruntime; print('gvr ocr then ort ok')",
]:
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", code], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300, cwd=os.path.join(os.path.dirname(__file__), ".."))
print(f"--- {code} -> exit {p.returncode} (0x{p.returncode & 0xffffffff:08X})", p.stdout.strip()[-200:], p.stderr.strip()[-600:], flush=True)