Server shutdown can exit mid-join, leaving a paused-and-resumed recording cut to its first segment

Aperta
#345 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
backend, devtools

Direzione di ricerca

Start with src/utils/sessions.ts and trace how classifyOrphan and reapOrphans handle dead recordings with parts; read the related stop and join flow in src/utils/lifecycle.ts and src/utils/pause.ts. Add or adjust a test for a dead-pid recording with parts, then run npm test. Done means an interrupted segmented recording is joined on startup or reported with an error that lists its parts.

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

Descrizione

effort: medium priority: medium reliability

Summary

On client disconnect, shutdown calls stopAll with a 10 s cap and then process.exit. A stop can need longer: up to 8 s for the graceful quit, up to 10 s in whenFinalized, then the stream-copy join of every segment. When the cap wins, the process exits with the join unfinished and the registry still says "recording". On the next start, classifyOrphan turns that record into a plain "stopped" with no error. Only "paused" records get the "parts were not joined" error.

Where

  • src/index.ts:132, 144 (shutdown cap, exit)
  • src/utils/lifecycle.ts:251-272, 322, 349-354 (stopAll, runStop)
  • src/utils/pause.ts:288 (finishSegments join)
  • src/utils/sessions.ts:134-140 (classifyOrphan)

Impact

A user who paused and resumed a long recording and then closed the client gets an outputPath holding only the first segment, with the rest left in <output>.parts/, and no error anywhere. The webcam alignment step is affected the same way.

Steps to reproduce

  1. Record a few minutes, pause, resume, and record several more minutes (large segments make the join slow).
  2. Close the client so the server shuts down.
  3. After a restart, get_session shows stopped with no error, the output is the first segment's length, and <output>.parts/part-001.mp4 remains.

Suggested fix

In reapOrphans, flag a dead "recording" record that has segments.parts.length > 0 (or a webcam) the same way paused ones are flagged, or better, re-run joinSegments for it at boot. Optionally persist an interim {status: "stopping"} so the next boot knows the join did not finish.

Acceptance criteria

  • A segmented recording whose join was interrupted is either joined at the next start or reported with an error that lists the parts.
  • Test for classifyOrphan/reapOrphans with a dead-pid recording record that has parts.

Getting started

  • Relevant files: src/utils/sessions.ts, src/utils/lifecycle.ts, src/utils/pause.ts
  • How to run tests: npm test

Filed by repo-audit/full-audit at b9b94fa. Severity: medium. Effort: M. audit-key: reliability|src/utils/lifecycle.ts|stopAll

Lingua principale
TypeScript
Stelle
1
Fork
4
Merge medio
14h 8m
PR unite (30g)
48

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 TMHSDigital/screencast-mcp

Tutte le issue di TMHSDigital/screencast-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.