fix(media): bodies hold no file between reads — a GC-closed handle killed the relay (4.15.1)
Some checks failed
Test / test (push) Has been cancelled
Docker build and publish / docker (push) Has been cancelled
Publish / publish (push) Has been cancelled

FileMediaStore.body() kept one FileHandle for the whole response and closed
it only at the end or on cancel. A player that seeks or closes mid-film often
triggers neither; the handle then fell to the garbage collector, which Bun 1.4
treats as fatal. The Prism relay restarted five times this way.

Each piece now opens and closes the file. Regression test runs in its own
process and checks no descriptor is open between reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-20 15:31:59 +02:00
parent 6852e09cb4
commit 200d5ad831
5 changed files with 78 additions and 9 deletions

View File

@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [4.15.1] — 2026-10-20 — Media: a relay no longer dies when a player walks away
### Fixed
- **`@shade/media`: `FileMediaStore.body()` held a file handle for the whole
response.** It was closed only when the client read to the end or the runtime
called `cancel`. A player that seeks or closes mid-film often does neither, so
the handle was left to the garbage collector — which Bun 1.4 treats as fatal.
The Prism relay restarted five times in four hours this way. Each piece now
opens and closes the file itself; nothing is held between reads. Regression
test: `tests/fixtures/abandoned-body.ts`, run in its own process, checks that
no descriptor is open between reads (fails on 4.15.0 under any Bun).
## [4.15.0] — 2026-10-18 — Media: films, video, images, audio and live streams, end to end
New package **`@shade/media`** — see `docs/media.md`.