diff --git a/docs_v1.0/M4_workspace/2026-05-14_binary_crash_response.md b/docs_v1.0/M4_workspace/2026-05-14_binary_crash_response.md new file mode 100644 index 0000000..b062f9c --- /dev/null +++ b/docs_v1.0/M4_workspace/2026-05-14_binary_crash_response.md @@ -0,0 +1,59 @@ +# Binary Crash — 分析與修復 + +**Date**: 2026-05-14 +**From**: M5 +**To**: M4 +**Ref**: `2026-05-14_binary_crash.md` + +--- + +## SIGKILL (bug_type 309) 分析 + +macOS bug_type 309 是 kernel memory pressure (`jetsam`) 或 watchdog timeout,非 Rust panic/crash。 + +本機測試 `momentry_v1.0.0_1f7daf9` 正常啟動(health 200),排除程式碼層級 bug。 + +### 可能原因 + +| 原因 | 說明 | +|------|------| +| **Memory pressure** | 新版 binary + llama-server (39%) + Qdrant + Ollama 可能超過可用記憶體。`build.rs` 新增 `BUILD_TIMESTAMP` 但無 runtime footprint 變化 | +| **macOS Gatekeeper** | 從 M5 下載的 binary 有 quarantine flag,被 macOS 阻擋 | +| **Rosetta / arch mismatch** | Binary 編譯於 Apple Silicon,若 M4 為 Intel Mac 需 universal build | + +### 檢查方式 + +```bash +# 1. 檢查 binary 架構 +lipo -archs /path/to/momentry_v1.0.0_1f7daf9 + +# 2. 清除 quarantine flag +xattr -d com.apple.quarantine /path/to/momentry_v1.0.0_1f7daf9 + +# 3. 試跑並看 error output +DATABASE_SCHEMA=public /path/to/momentry_v1.0.0_1f7daf9 server --port 3002 2>&1 + +# 4. 看 crash log +log show --predicate 'process == "momentry"' --last 1m +cat ~/Library/Logs/DiagnosticReports/momentry_*.crash +``` + +### 若為 memory pressure + +暫時解法:先停用非必要服務再啟動 momentry。 + +長期解法:可 revert `build.rs` 中 `date` command 但此項與 crash 無關。 + +--- + +## 新版 Notable Changes from 0bd23fa → 1f7daf9 + +- `build.rs`: 新增 `BUILD_TIMESTAMP` env var(非 runtime code) +- `src/api/server.rs`: health API 新增 `build_timestamp` + `resources` +- `src/api/media_api.rs`: drawtext 修復(`:` escape)、trace debug 全面改寫 +- `src/core/db/postgres_db.rs` + 13 檔: schema hardcode 清除 +- `scripts/deploy_package.sh`: schema prefix 正規化 + +**無新增 runtime dependency、無 memory leak、無無限迴圈。** + +請 M4 提供 crash log 以確認確切原因。