dockerContainerStats: the first container of every refresh keeps docker stats' clear-screen codes in its id

オープン 初心者向け
#2,131 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

評価

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

調査の方向性

docker-stats.service.ts の DockerStatsService.processStatsLine(92 行目)から始めます。issue によるとエスケープコードが削除されている箇所です。正規表現を、再現例の erase-display シーケンスおよび cursor-home シーケンスと比較します。必要に応じて、useDockerContainerStats.ts と DockerContainerStatCell.vue で報告された ID の照合動作を確認します。更新のたびに、公開されるすべての ID が期待されるサーバー ID および container ID の形式に一致すれば完了です。

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

説明

Environment

Unraid OS Version: 7.3.4 (Docker 29.8.2)

Are you using a reverse proxy? No

Pre-submission Checklist

  • I have verified that my Unraid OS is up to date
  • I have tested this issue by accessing my server directly (not through a reverse proxy)
  • This is not an Unraid Connect related issue

Issue Description

DockerStatsService.processStatsLine (docker-stats.service.ts:92) strips escape codes with /\x1B\[[0-9;]*[mK]/g. That removes colour and erase-line codes but not the erase-display and cursor-home pair (\x1B[J\x1B[H) that docker stats writes at every refresh, so the first container of every refresh is published with the pair in front of its ID, and a client that matches stats to containers by ID never gets that container's stats. The Docker overview component would show "—" for it, since it stores stats under the published ID (useDockerContainerStats.ts:18) and looks them up by the container's ID (DockerContainerStatCell.vue:16), but it is not enabled on 7.3.4 (DockerContainersPageModification.shouldApply returns false).

Steps to Reproduce

  1. On the server, run docker stats --format '{{.ID}}' --no-trunc | od -c: every refresh starts with 033 [ J 033 [ H before the first ID.
  2. Subscribe to subscription { dockerContainerStats { id } }.
  3. Watch the IDs for a few seconds.

Expected Behavior

Every ID is <server-id>:<container-id>.

Actual Behavior

The first ID of each refresh is <server-id>:\u001b[J\u001b[H<container-id>, the same container every time here. Replaying 7 s of docker stats output from this server (33 containers, 12 refreshes) through DockerStatsService, 12 of the 396 published IDs match no running container.

Additional Context

Stripping every CSI sequence fixes it: /\x1B\[[0-9;?]*[ -/]*[@-~]/g. The socket-based rewrite proposed in #2008 (for #2007) would also remove it, since it stops parsing docker stats output. #2120 is a different problem in the same service.

主要言語
TypeScript
スター
123
フォーク
25
平均マージ
2日 16時間
マージ済み PR(30日)
9

環境構築

はじめの一歩

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

unraid/api のほかの issue

unraid/api の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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