fix: ブラウザ起動失敗時にプロファイルを自動修復して再試行する - #64
Merged
Merged
Conversation
使い込まれたプロファイルと古いChromium・新しいmacOSの組み合わせで Chromiumが起動時にクラッシュし、unhandled rejectionの生スタック トレースでbm-view-previewが落ちることがあった。 - 起動失敗時、ログイン情報(Cookies / Login Data / Local Storage / WebStorage / Local State)だけを引き継いだプロファイルに作り直して 1回だけ再試行する。元のプロファイルは丸ごと退避して残す - 別のbm-view-previewが同じプロファイルで起動中の場合は修復せず、 プロセスIDつきのメッセージを出して終了する - binにtry/catchを追加し、エラーを日本語メッセージで表示する version bump (0.0.13) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yebis0942
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
利用側リポジトリで
bm-view-previewの起動が以下のエラーで落ちる事象が発生した。実機調査の結果、原因は多重起動ではなく、使い込まれた永続プロファイル × 古いChromium(0.0.11のPlaywright 1.53 = Chromium 138)× macOS 26.3.2 の組み合わせで Chromium 本体が起動直後に SIGTRAP でクラッシュするものだった(macOSのクラッシュレポートで確認。空プロファイルでは正常に起動し、同じプロファイルでも 0.0.12 の新しい Chromium なら正常に起動する)。
また、launch の失敗が unhandled rejection になるため、利用者には生のスタックトレースと大量の Chromium ログしか見えず、原因も対処も分からない状態だった。
変更内容
lib/chromiumProfile.js新規): ブラウザ起動に失敗したとき、ログイン情報(Cookies/Login Data/Local Storage/WebStorage/Local State)だけを引き継いだプロファイルに作り直して 1 回だけ再試行する。元のプロファイルはchromium_profile.broken-<timestamp>に丸ごと退避して残すSingletonLockの指す pid が生存している場合は「プロファイルを別インスタンスが使用中」なので修復せず、プロセスIDつきの案内を出して終了する(使用中のプロファイルを退避してしまう事故の防止)。stale lock(死んだ pid)は Chromium 自身が回復できるため関与しないbin/bm-view-preview.js): top-level の try/catch を追加し、予期しないエラーを日本語メッセージで表示(生スタックトレースの unhandled rejection を廃止)検証
pnpm test(vitest 18件)pnpm views devが正常起動することを確認🤖 Generated with Claude Code