x265-only relauncher; STATE: the 16:51 stop was a machine reboot

- run/relaunch_x265.sh: start ONLY the x265 tier. run/relaunch_tiers.sh hardcodes
  `for t in x265 nvenc`, and the nvenc tier must not start while another job owns the
  GPU (the TubeSync 58-file repair batch holds it since 2026-10-09 20:36). x265 is
  pinned to the E-cores, so it shares only the RaiDrive mount -- 2 concurrent share
  jobs is the documented safe limit.
- The launcher redirects its own banners into the log (under -WindowStyle Hidden,
  stdout goes nowhere) and documents the -ArgumentList form: the script path alone.
- STATE.md: LastBootUpTime 2026-10-09 16:51:58 -- both tiers stopped by a REBOOT, not a
  bug (x265 404/589, nvenc 308/589); the stale lock pids need no cleanup because
  transcode.Lock is staleness-aware. Memory after reboot: 13 GB free / 50.3 of 55.9 GB
  committed, but the commit limit fell from 79.6 GB because D: is 92% full.
This commit is contained in:
2026-10-09 20:53:34 +08:00
parent f4ab797580
commit bd8382e334
2 changed files with 61 additions and 11 deletions
+16 -11
View File
@@ -4,21 +4,26 @@
## 现在在跑什么
**两档都停着** —— 2026-10-09 11:30 业主叫停,先修 bug 再重启;进程已按 PID 全部清掉,GPU encoder 0 %。
**重启前先读「第 10 个 bug:MemoryError」和「8 个 `.new.mp4` 残留」两节**,并先腾内存。
原设计:两个 HEVC 档在跑,各自独立的锁(`run-x265.lock` / `run-nvenc.lock`;x265 = E 核,nvenc = GPU ASIC,互不争抢)。
**它们不在 Hermes 的进程管理里** → `process_manage` 看不到,也没有退出通知:只能看日志、按 PID 杀。
**只有 x265 一档在跑**(2026-10-09 20:51:41 起,单档启动器 `run/relaunch_x265.sh`)。
**nvenc 档故意不启动** —— GPU 被 TubeSync 的 58 个文件修复批次占着(20:36 起,与铁律一致:同一颗编码器不能两个任务)。
```bash
# 断点续跑(幂等:已转好的自动跳过,失败项文件未动,下一轮自动重做),每档最多重试 8 次
bash /d/tmp/xcode/relaunch_tiers.sh
# 看进度
tail -f /d/tmp/xcode/run_x265.log /d/tmp/xcode/run_nvenc.log
# 只起 x265(E 核,纯 CPU)—— 仓库源 run/relaunch_x265.sh 拷到 /d/tmp/xcode/ 再跑
powershell -NoProfile -Command 'Start-Process -FilePath "C:\Program Files\Git\bin\bash.exe" -ArgumentList "D:/tmp/xcode/relaunch_x265.sh" -WindowStyle Hidden'
# ⚠ 参数必须只有脚本路径;写成 -ArgumentList "-lc","bash <脚本>" 会起一个交互式 bash,什么都不跑
tail -f /d/tmp/xcode/run_x265.log
```
### 2026-10-09 16:51:58:两档是**整机重启**停的,不是 bug
(两档都不在 Hermes 的进程管理里 → `process_manage` 看不到,也没有退出通知:只能看日志,按 PID 杀。)
`LastBootUpTime = 2026-10-09 16:51:58`;x265 日志停在 16:50:42(404/589)、nvenc 停在 16:51:30
(308/589)。11:48 由 relauncher 重新拉起、跑到重启为止。锁文件里那两个 PID(23792 / 50128)已是死号 ——
`transcode.Lock` 是**过期感知**的(age > 300 s 且 pid 已死即接管),不需要手工清锁。
重启后内存正常:物理空闲 12.9–13 GB、提交 50.3/55.9 GB(11:19 那次 MemoryError 时是 96.5%)。
⚠ 但提交上限从 79.6 GB 缩到 55.9 GB:D: 已 92% 满,pagefile 长不上去。
### 为什么改成"脱管"启动 —— 10:37 那次全停的教训(第 9 个 bug)
上一轮的 x265 / nvenc 是 Hermes 后台进程。**用户停会话时它们被一起杀了**:两个都停在编码到一半
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Start ONLY the x265 tier of the 樊登读书会 conversion, DETACHED from Hermes.
#
# Why a separate launcher: run/relaunch_tiers.sh hardcodes `for t in x265 nvenc`, and the nvenc
# tier must NOT start while another job owns the GPU -- the TubeSync 58-file repair batch has held
# the GPU encoder since 2026-10-09 20:36. x265 is pure CPU pinned to the E-cores (0x3FF0000), so it
# shares nothing with the GPU job; the only shared resource is the RaiDrive mount, and 2 concurrent
# share jobs is the documented safe limit (3 produced `[Errno 9] Bad file descriptor`).
#
# Detached for the reason recorded in STATE.md: a Hermes-scoped background job is killed when the
# session ends (measured 2026-10-08 10:37, both tiers killed mid-encode), so the launcher is started
# by `powershell Start-Process ... -WindowStyle Hidden` and its parent exits immediately. No exit
# notification -- watch the log; stop by PID only, never by image name.
#
# Idempotent: already-converted files are skipped, a failure leaves the live file untouched and the
# next attempt retries it. Lock: C:\AI\transcode-run\run-x265.lock (stale-aware: age > 300 s AND a
# dead pid is taken over automatically, so the lock left by the 16:51 reboot needs no cleanup).
#
# Started correctly (the argument form matters): the script path goes in -ArgumentList ALONE.
# Start-Process -FilePath "C:\Program Files\Git\bin\bash.exe" -ArgumentList "<this script>" -WindowStyle Hidden
# NOT "-lc","bash <script>" -- that runs an interactive bash instead and starts nothing.
set -u
TOOLS=/c/Users/hoelee/AppData/Local/hermes/tools
PY="$(ls -d $TOOLS/python-*/python.exe 2>/dev/null | head -1)"
LIB='Z:\Class\#snapshot\GMT+08-2026.09.25-09.50.20\樊登读书\樊登读书会(每周更新)'
LOG=/d/tmp/xcode
OUT="$LOG/run_x265.log"
# The launcher's own banners go into the log too: under -WindowStyle Hidden stdout goes nowhere,
# so an unredirected banner leaves no evidence of how a run ended.
exec >> "$OUT" 2>&1
cd /d/dev/universal-video-transcode || { echo "FATAL cannot cd to the repo"; exit 1; }
echo "=== x265-only relauncher start $(date '+%F %T') py=$PY"
echo "=== origin root: $LIB"
if [ ! -x "$PY" ]; then echo "FATAL python not found under $TOOLS"; exit 1; fi
for i in 1 2 3 4 5 6 7 8; do
echo "=== relaunch attempt $i $(date '+%F %T')"
"$PY" -u scripts/library_run.py --tier x265 --origin-root "$LIB" --reverse
rc=$?
echo "x265 PASS-DONE rc=$rc attempt=$i $(date '+%F %T')"
[ $rc -eq 0 ] && break
sleep 60
done