[#49]chore:バックエンド健全性調査のためのログ仕込みと exit/health 監視を追加#50
Closed
KimMaru10 wants to merge 1 commit into
Closed
Conversation
長時間稼働後にバックエンドが応答しなくなり「更新を押すとローディングが
終わらない」事象の原因を切り分けるための観測強化。根本修正ではなく、
再現を待ってログから仮説を絞り込めるようにすることが目的。
- バックエンドの stdout/stderr を app.getPath('logs')/backend.log に追記
- spawn / exit / health 状態など主要イベントも同ログに記録
- exit ハンドラを (code, signal) で受け、シグナル終了 (SIGTERM を除く)
も "処理が予期せず終了しました" のアラート対象に含める
- 起動完了後に 30 秒間隔の health watcher を開始し、3 回連続失敗で
OS 通知を一度だけ表示。復旧したら状態リセット
- waitForHealth / watcher の HTTP レスポンスを res.resume() で消費して
Keep-Alive socket の解放を保証
Owner
Author
|
@claude このプルリクエストをレビューしてください。 |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Owner
Author
|
検証完了のためクローズする |
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.
変更の概要
長時間稼働後にバックエンドが応答しなくなり「更新ボタンを押してもローディングが終わらない」事象 (#49) の原因切り分け用の観測強化。根本修正ではなく、再現を待ってログから仮説を絞り込めるようにする。
関連 Issue
変更の種類
変更内容の詳細
src/main/backend.ts のみ。
app.getPath('logs')/backend.logに追記モードで pipe(code, signal)で受け、シグナル終了 (SIGTERM 以外) も「処理が予期せず終了しました」アラートの対象に含める。OOM kill / クラッシュも検知できるように/api/healthを ping。3 回連続失敗で OS 通知を 1 度だけ表示。復旧したら状態リセット安全性チェック
method/uri/status/latencyのみ出力する設定 (backend/cmd/main.go:51-53)。Authorization ヘッダや API トークンは stdout に乗らないことを確認済み動作確認
npm run dev起動・停止サイクル正常)レビュアーへのメモ
TODO(#49)を残してある。調査完了後に削除 or ローテーション機構の追加を判断healthNotifiedAtで 1 回に絞り、復旧でリセット)npm run devを起動したまま長時間放置し、再現を待ってログを~/Library/Logs/Backnote/backend.logから確認する想定チェックリスト