#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Diagnose Neko #8 Chrome SIGILL on dy and apply known safe mitigations.""" from __future__ import annotations import sys import time from pathlib import Path import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") ROOT = Path(__file__).resolve().parents[1] HOST, PASS = "108.174.50.68", "Xiao4669805" LOCAL_LAUNCH = ROOT / "backend" / "neko" / "browser-launch.sh" def connect(): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in range(10): try: c.connect(HOST, 22, "root", PASS, timeout=40, allow_agent=False, look_for_keys=False, banner_timeout=90) return c except Exception as e: print(f"ssh_retry {i}: {e}", flush=True) time.sleep(2 + i) raise SystemExit("ssh_fail") def run(c, cmd, t=120): _, o, e = c.exec_command(cmd, timeout=t) return (o.read() + e.read()).decode("utf-8", "replace") c = connect() print("=== diagnose neko8 ===", flush=True) print( run( c, r""" set +e echo "-- container --" docker ps -a --filter name=douyinweb-neko-8 --format '{{.Names}} {{.Status}}' echo "-- chrome flags in container --" docker exec douyinweb-neko-8 bash -lc 'head -n 5 /usr/local/bin/browser-launch.sh 2>/dev/null; grep -nE "SIGILL|OPENSSL|jitless|disable-gpu|memory-model|crash" /usr/local/bin/browser-launch.sh 2>/dev/null | head -40' echo "-- recent chrome/neko logs --" docker logs --tail 80 douyinweb-neko-8 2>&1 | grep -iE 'SIGILL|Aw, Snap|Illegal|chrome|FATAL|oom|killed' | tail -40 echo "-- CDP --" docker exec douyinweb-neko-8 bash -lc 'curl -fsS -m 2 http://127.0.0.1:9222/json/version 2>&1 | head -c 300; echo; curl -fsS -m 2 http://127.0.0.1:9222/json/list 2>&1 | head -c 400; echo' echo "-- host cpu --" lscpu | grep -E 'Model name|Flags|Vendor|Architecture' | head -10 echo "-- mem --" free -h | head -3 """, 90, ), flush=True, ) # Compare local vs container launch script for SIGILL mitigations local = LOCAL_LAUNCH.read_text(encoding="utf-8", errors="replace") print("local_has_jitless", "--jitless" in local or "jitless" in local, flush=True) print("local_has_OPENSSL", "OPENSSL_ia32cap" in local, flush=True) c.close()