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

Aperta Adatta ai principianti
#2,131 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, typescript
Ambito
api, backend

Direzione di ricerca

Inizia in docker-stats.service.ts, in DockerStatsService.processStatsLine (riga 92), dove l’issue segnala che i codici di escape vengono rimossi, e confronta l’espressione regolare con le sequenze erase-display e cursor-home nella riproduzione. Se necessario, controlla il comportamento di corrispondenza degli ID segnalato in useDockerContainerStats.ts e DockerContainerStatCell.vue. Il lavoro è concluso quando ogni ID pubblicato corrisponde al formato ID del server e container previsto a ogni aggiornamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
123
Fork
25
Merge medio
2g 16h
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di unraid/api

Tutte le issue di unraid/api

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.