fix: stop the access log watcher when Charon shuts down

オープン
#2,138 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Wikid82 がすでに取り組んでいます。

2026年12月3日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
backend

調査の方向性

Read backend/internal/services/log_watcher.go and the watcher setup in backend/internal/api/routes/routes.go; compare how the stats ingester and hub receive the application context. Start by tracing LogWatcher.Start(ctx) and its tail loop. Add a test that cancellation stops the loop, then verify the watcher shuts down with server.Run(ctx) and releases its resources.

索引モデルが issue の本文から書いたものです。

説明

backend low

What

The access log watcher keeps running until the process exits instead of stopping with the application context.

  • backend/internal/api/routes/routes.go (log watcher block, logWatcher.Start(context.Background())) starts it with a background context, and nothing calls LogWatcher.Stop() at shutdown.
  • LogWatcher.Start(ctx) (backend/internal/services/log_watcher.go:45) ignores its ctx argument; the tail loop watches the watcher's own context created in NewLogWatcher (:34-42).

CLAUDE.md asks long-running work to respect server.Run(ctx).

Severity

Low. The process exits at shutdown anyway; the gap is an unclean stop (open file handle, subscriber channels left open) and a pattern that differs from the stats ingester and hub, which take ctx.

Suggested approach

Have Start derive the tail loop's context from its ctx argument (or call Stop from context.AfterFunc(ctx, ...)), pass the application context from RegisterWithDeps, and add a test that the tail loop ends when the context is cancelled.

Found while planning #2132.

主要言語
Go
スター
17
フォーク
2
平均マージ
1時間 42分
マージ済み PR(30日)
173

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Wikid82/Charon のほかの issue

Wikid82/Charon の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。