Repository navigation
Conversation
…crets
A transcode node now needs only the core's URL and its own key. It holds no
database or Redis connection and no cluster-wide secret.
- Per-node keys: the core issues each transcode node its own key (rotated
from web admin or POST /api/v2/admin/nodes/{id}/key), and signs every call
with the key of the node it targets. Proxies keep the shared secret. A node
whose key the core rejects reports that through health and takes no work.
- Core-served node state: nodes fetch their configuration from the core and
send it their reports, stream telemetry and operational logs, instead of
reading and writing the database and Redis.
- Resolve and relay deny: a restarted node rebuilds a session from the
recipe the core's resolve endpoint returns, and the core refuses relays and
resolves for stopped or denied transports.
- Source grants: every job the core sends a node carries a short-lived grant
for its source file. With local source access the node opens its own mount
and checks the approved revision; with core source access it reads the file
through the core over a loopback relay held to the admitted protocols and
demuxers.
- Relayed media consumers: transcodes, downloads, trickplay, chapter
thumbnails, media sampling, subtitle sync and theme audio all run on
relayed sources. Text-subtitle burn-in from a relayed source is refused,
so that work goes to a node with the library or to the API server. A
transcode moved off an unreachable node gets a fresh grant and a recipe
bound to its new node, and the move rechecks stop markers.
- Web admin shows each node's source access and key state and issues keys.
- Docs describe thin nodes, the node control protocol and source access.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
We checked this against what we need from transcode nodes. We run dedicated, mountless GPU nodes for customers who administer their own Silo cluster, sometimes across a public network. The thin-node model covers most of it: no Postgres, Redis or shared secret on the node, Five things are still missing for our use. Each item below says what is missing and gives a concrete way to close it. Paths refer to this branch at 1. Operator-owned encoding ceiling (blocking for us)Need. The node's operator sets a hard limit on concurrent encoding work. The limit covers playback, prepared downloads, trickplay, chapter thumbnails, media samples and subtitle sync together. The customer's admin can lower it with What this branch has. The node environment is How to meet it. Port the ceiling half of #2371. That code already exists and is tested:
Acceptance criteria.
The enrollment half of #2371 existed so operators would not have to hand each node the customer's database, Redis and 2. Performance evidence for core source accessNeed. A mountless node must match a library-mounted node on startup, seek, producer throughput and concurrent capacity. What this branch has. It shows correctness (frame hashes match between core and local mode) but has no timing numbers. Two design points could cost speed on remote nodes:
How to meet it. #2408 already documents a paired method and its results in
We'd like core mode to land in the same range. We can run that harness against this branch and post the numbers here. 3. Text subtitle burn-in on core-mode nodesEvery node we run is core mode. Until #2526 lands, every text burn-in moves to the customer's API server CPU, or fails where the routing policy doesn't allow local execution. Please merge #2526 together with this PR, or straight after it in the same release. 4. TLS on the node listenerNeed. Remote nodes over a public network, with plain HTTP still available on a trusted LAN. What this branch has. The node listens on plain HTTP: How to meet it.
If you'd rather not add TLS to the binary, the alternative is a documented TLS-terminating sidecar example (Caddy or nginx) in 5. Reverse-proxy example in the upgrade guide
location /api/internal/nodes/ {
proxy_pass http://silo_api;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_request_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
client_max_body_size 2m; # reports and log batches go up to 1 MiB; nginx's default limit is 1m
} |
| if err := h.revokeNodeRecipes(ctx, node); err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
HLS reconstruction bypasses stored-recipe revocation in internal/api/handlers/admin_node_reload.go because nodecontrol.resolveHLS treats a revoked recipe as a store miss and accepts the card derived from an already-issued complete stream token, allowing the next manifest request to restart the transport immediately after force reload. Enforce the node's revocation generation or a transport tombstone before accepting the complete-token fallback.
Prompt for LLM
File internal/api/handlers/admin_node_reload.go:
Line 59 to 61:
HLS reconstruction bypasses stored-recipe revocation in internal/api/handlers/admin_node_reload.go because nodecontrol.resolveHLS treats a revoked recipe as a store miss and accepts the card derived from an already-issued complete stream token, allowing the next manifest request to restart the transport immediately after force reload. Enforce the node's revocation generation or a transport tombstone before accepting the complete-token fallback.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
|
We ran the benchmark from item 2 against this branch ( Setup
Results
Over HTTPS, core-mode throughput was 695 fps in all three runs, so the 5% is consistent, not noise. #2408's raw-FFmpeg measurement showed the same pattern (96.7% over HTTPS, 98.7% over HTTP). The node has 2 cores shared by FFmpeg and the TLS relay; we did not isolate the cause. Readiness moves in 100 ms steps in both modes.
This predates the PR and affects local nodes too. Waking those waits when the segment is written, instead of on a 100 ms timer, could take up to one step off each wait for every node. Correction to item 2: the copy-video double readI said the first copy-video start in core mode reads the file twice. That only happens with
So the fix suggested in item 2 (the core verifies the Matroska index and returns it on a grant-keyed route) still applies, but only to installs that turn the setting on. Without it, there is nothing to fix for copy-video. What's left from item 2
|
|
@Quick104 the 100 ms readiness steps in the benchmark above come from FFmpeg output polling in Same Flex 140 setup, this branch at
The diff applies cleanly on top of |
…des (#2526) * feat(nodes): stage relayed text subtitles for burn-in on core-mode nodes A node that reads its source through the core can now burn in a text subtitle instead of refusing it. The libass subtitles filter opens its file itself, outside FFmpeg's input restrictions, so it must not open the relay URL. The node instead extracts the selected track to an ASS script, with the source's attached fonts, into a node-level staging cache keyed by source revision, track and codec. Every start, restart and rebuild on that source and track reuses it. - Staging runs detached from the request on a reopened source handle, with bounded admission (two at a time, a queue of eight), byte reservations against a 1 GiB cache, leases, idle cancellation and a timeout that grows with the file. A full queue or cache answers 503. - A start whose staging is not complete returns a preparing session, and FFmpeg launches once staging completes. Segment and init requests wait meanwhile as for a slow FFmpeg start. - A staging failure does not advance the hardware fallback, and a rebuild does not retry it in software. - This also restores the session closing state and shutdown under each session's lifecycle lock, which the separate shutdown-race fix brings to main; the pending launch depends on it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(nodes): build burn-in subtitle bundles on the core A core-mode node no longer demuxes the whole source through the relay to burn in a text subtitle. The core builds a subtitle bundle (the track as an ASS script extracted with -copyts, plus every font attachment) from its own copy, caches it in the subtitle cache, and serves it at GET /api/internal/nodes/sources/subtitle under the source grant. Each session fetches the bundle into its own output directory and launches FFmpeg once it is unpacked. This replaces the node-level staging cache with its slots, queue, leases, eviction, adoption and fsync. Closing a session cancels its fetch, and a passing core failure answers 503 for starts and rebuilds. A readiness-gated start waits for the bundle within its request before FFmpeg's manifest wait. A same-ID replacement retires the live session only once its bundle is staged. Restarts share the start's spawn and publish path, and attachment dumping streams through one helper shared with the client font bundle. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(nodes): bind subtitle bundles to the grant and fail staging before acceptance The core now builds and serves a subtitle bundle only for the granted source revision, and answers 412 when the file changed. A build that fails for the core's own reasons (its disk, a process that cannot start) answers 503, not 422, so nodes retry it. A bundle download cut short is retried as a passing failure. Jellyfin-compatible text burn-in starts now require readiness, as native starts already do, so a staging failure fails the start, where the fallback to another node or the API server runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| c.mu.Lock() | ||
| c.bundleFailures[fill.key] = subtitleBundleFailure{err: err, at: time.Now()} | ||
| c.mu.Unlock() |
There was a problem hiding this comment.
Unbounded negative-cache growth in internal/playback/subtitle_bundle.go occurs because bundleFailures deletes expired failed-build entries only when the identical key is requested again, allowing a registered node with a valid source grant to grow the core's heap by continually requesting different nonexistent track ordinals. Sweep expired entries independently of lookups and cap the negative cache.
Prompt for LLM
File internal/playback/subtitle_bundle.go:
Line 242 to 244:
Unbounded negative-cache growth in `internal/playback/subtitle_bundle.go` occurs because `bundleFailures` deletes expired failed-build entries only when the identical key is requested again, allowing a registered node with a valid source grant to grow the core's heap by continually requesting different nonexistent track ordinals. Sweep expired entries independently of lookups and cap the negative cache.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if err != nil { | ||
| return sourceFault(fmt.Errorf("extract track: %w", err)) | ||
| } |
There was a problem hiding this comment.
Error misclassification in internal/playback/subtitle_bundle.go routes core scratch-file output-write errors such as ENOSPC from boundedRun through sourceFault, producing a cached 422 and nonretryable ErrSubtitleStaging instead of a transient 503. Distinguish local output I/O errors from FFmpeg/source failures before wrapping ErrSubtitleBundleFailed.
Prompt for LLM
File internal/playback/subtitle_bundle.go:
Line 290 to 292:
Error misclassification in `internal/playback/subtitle_bundle.go` routes core scratch-file output-write errors such as ENOSPC from `boundedRun` through `sourceFault`, producing a cached 422 and nonretryable `ErrSubtitleStaging` instead of a transient 503. Distinguish local output I/O errors from FFmpeg/source failures before wrapping `ErrSubtitleBundleFailed`.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if err := fill.Commit(); err != nil { | ||
| slog.Warn("subtitle bundle commit failed", "component", "playback", | ||
| "input", src.Path, "track", src.Track, "error", err) | ||
| return |
There was a problem hiding this comment.
Negative-cache bypass in internal/playback/subtitle_bundle.go lets OpenSubtitleBundle immediately start another whole-source build after Commit fails, discards the fill, and releases its key. Record commit failures before allowing another build for that key so persistent cache write, sync, or publish failures receive the documented one-minute backoff instead of triggering repeated demuxes that consume shared warm slots.
Prompt for LLM
File internal/playback/subtitle_bundle.go:
Line 250 to 253:
Negative-cache bypass in `internal/playback/subtitle_bundle.go` lets `OpenSubtitleBundle` immediately start another whole-source build after `Commit` fails, discards the fill, and releases its key. Record commit failures before allowing another build for that key so persistent cache write, sync, or publish failures receive the documented one-minute backoff instead of triggering repeated demuxes that consume shared warm slots.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| @@ -2803,6 +3015,16 @@ func (s *TranscodeSession) SegmentRecoveryDecision(segNum int, now time.Time) Se | |||
| decision.WaitTimeout = activeSegmentWait | |||
| decision.RestartOnTimeout = false | |||
| decision.Reason = segmentReasonRestarting | |||
| case progress.Preparing: | |||
There was a problem hiding this comment.
Recovery-path suppression in internal/playback/transcode.go occurs after a seek restart when subtitle staging is pending and a missing requested segment falls below StartSegmentNumber: the unconditional progress.Preparing case overrides the segNum < progress.StartSegmentNumber recovery case, selecting a 12-second wait with RestartOnTimeout disabled even though the pending generation cannot produce that segment. Restrict the preparing wait to segNum >= progress.StartSegmentNumber so earlier requests follow the restart path instead of timing out with a 404.
Kody rule violation: Use source anchors and produced-head state in planned segment recovery
Prompt for LLM
File internal/playback/transcode.go:
Line 3018:
Recovery-path suppression in `internal/playback/transcode.go` occurs after a seek restart when subtitle staging is pending and a missing requested segment falls below `StartSegmentNumber`: the unconditional `progress.Preparing` case overrides the `segNum < progress.StartSegmentNumber` recovery case, selecting a 12-second wait with `RestartOnTimeout` disabled even though the pending generation cannot produce that segment. Restrict the preparing wait to `segNum >= progress.StartSegmentNumber` so earlier requests follow the restart path instead of timing out with a 404.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Problem
Related issue: #1176
Validation tasks: none (no passed case is affected; #1177 C1–C3 and #1178 C1–C3 have not run, and their node registration steps now include issuing a key)
A remote transcode node today is the full
silobinary with the main server's Postgres connection, Redis,SECRET_KEYand the sharedauth.jwt_secret, which also signs login and stream tokens. It must also mount the media library at the exact paths the catalog uses. Anyone who controls a GPU box therefore holds credentials to the whole deployment, and a node without shared storage cannot work at all.This change makes the one existing transcode node type thin. A node starts with two settings,
SILO_CORE_URLandSILO_NODE_KEY, and holds no database, Redis or shared secret. It reads source media either through its own mount (the default, as today) or over HTTP from the core, chosen per node. Client routes, responses and playback behavior are unchanged.Approach
stream_nodesrow. Requests to a transcode node are signed with that node's key; the shared secret is now used only for proxies. Signing names the kind of node it targets, so a transcode node never receives a shared-secret signature. The node signs its own calls to the core with the same key under a separate label, so a request captured in one direction never verifies in the other./api/internal/nodes/, outside user auth and request logging.resolveroute, which runs the checks the node used to run, binds the recipe to the asking node and returns the playback identity. Relays check stop markers before signing; the Jellyfin-compatible relays gained that check. Recipe deletion happens where the core stops a session.localmode the node exchanges it for the approved catalog path. Incoremode it reads the bytes from the core through a loopback relay that FFmpeg and Go readers use, with resume after interruptions. FFmpeg inputs from the relay get protocol and format whitelists. Tone-map validation, the Matroska keyframe index, the DV probe, concat sampling and keyframe plan records work on relayed sources. Text-subtitle burn-in on a core-mode node is refused so the work moves to a local-mode node or the server; staging subtitles for it is the stacked follow-up PR.source_access(transcode nodes only) andkey_issued, andPOST /api/v2/admin/nodes/{id}/keyissues or rotates a key, with capability flags for both. The web nodes page shows key status, issues and rotates keys (the key is shown once), and sets source access.The design is documented in
docs/architecture/transcode-nodes.md;docs/update-to-1.0.mdhas the operator steps. This replaces the approach in #2408, which added a second, standalone worker type next to the existing node.Surfaces: server and web admin. No Apple, Android or Jellyfin client change. The user manual needs an update: Silo-Server/siloserver.org#213.
Validation
make lint-changed(0 issues), and race tests for every touched package, run against Postgres 18 and Redis. Known failures that also fail on main:TestAdminSubtitleListPageDB,TestCatalogTransferPersistsJobsAndSignedLink,TestManagedCreateAbsenceRacePostgres.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2525/
Risks
docs/update-to-1.0.md). Proxies keep their current settings.stream_nodes.node_key_ciphertextandstream_nodes.source_accessand includessource_accessin the configuration revision trigger./api/internal/nodes/*without buffering. In core mode every byte a node reads passes through the API.dependency_unavailable(v2). When a recipe exists in the core's store, a node rebuild uses it in preference to the stream token, and a store read error answers 503.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Run transcode nodes without database, Redis, or shared secrets via per-node keys and source grants
SILO_CORE_URLandSILO_NODE_KEY; nodes pull their configuration, report sessions, and ship logs to the core over the new node-control endpoints (server.go).nodeauth.SignTranscode/SignToCore/VerifyFromNodeuse separate MAC domains, keys are encrypted at rest in the newnode_key_ciphertextcolumn, and aKeyRegistryserves credentials for signing and core-side verification.SourceAccess.Macroscope summarized 97501ff. (Automatic summaries will resume when PR exits draft mode or review begins).