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

未关闭 适合新手
#2,131 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 小时
30 天内合并 PR
9

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

unraid/api 的其他 Issue

查看 unraid/api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。