Skip to content

Fall back to a cached engine manifest when the CDN is unreachable - #342

Closed
RavenAzala wants to merge 1 commit into
space-wizards:masterfrom
RavenAzala:manifest-disk-fallback
Closed

RavenAzala wants to merge 1 commit into
space-wizards:masterfrom
RavenAzala:manifest-disk-fallback

Conversation

@RavenAzala

Copy link
Copy Markdown

Fixes #341.

Problem

Connecting to a server requires resolving the server's engine version via the Robust builds manifest (manifest.json, hosted on robust-builds.cdn.spacestation14.com). If the CDN is unreachable (e.g. #274 — blocked by ISP-level filtering in Russia), this fails even when the engine version the server wants is already installed on the player's machine: the manifest is resolved before the "is this engine installed?" check in DownloadEngineIfNecessary, so a dead CDN bricks connecting to every server for affected players.

Changes

  • Persist a copy of manifest.json and modules.json to the launcher's local data dir (engine_build_manifest.json / engine_module_manifest.json) after each successful download. The raw JSON is persisted so the fallback copy is byte-identical to what was fetched.
  • If downloading a manifest fails (all UrlFallbackSet URLs unreachable), fall back to the persisted copy, if any.
  • User cancellation (OperationCanceledException with the token actually cancelled) is still propagated; the fallback only triggers on genuine network failures.
  • Failures reading/writing the disk cache only log a warning and never break the connection flow.
  • Writes are atomic (temp file + File.Move overwrite) so a crash mid-write can't corrupt the cache.
  • Deserialization goes through JsonSerializerOptions(JsonSerializerDefaults.Web), matching what GetFromJsonAsync used before, so wire-format handling is unchanged.

Limitations

  • This does not help players who need to download a new engine version while the CDN is down — that fundamentally needs a mirror (see Engine builds CDN (Datacamp) unreachable from Russia — needs Russian-hosted fallback #274 for the infrastructure-side discussion). What it does fix: connecting to servers whose engine version the player already has installed, which is the common case for anyone who has played before.
  • The fallback manifest may be stale (e.g. an engine version released while the CDN was unreachable for that player won't resolve). That is no worse than the current hard failure.

Notes

  • Security: the disk cache only ever contains data previously fetched over HTTPS from the official CDN, and downloaded engine/module zips still go through signature verification, so a tampered cache file cannot get unverified native code executed.
  • Manually verified against the live CDN: manifest (~1100 versions) and modules manifest deserialize identically through the new path, and redirect chains such as 286.0.0 -> 286.0.3 resolve via the fallback.

Related: #274 (CDN blocked from Russia), #182 (slow CDN downloads).

Engine version resolution requires the Robust builds manifest from
robust-builds.cdn.spacestation14.com. When that CDN is unreachable
(e.g. blocked network regions such as Russia, see space-wizards#274), connecting
to any server fails with "Unable to find engine version in manifest",
even if the requested engine version is already installed locally.

Persist the manifest (and engine module manifest) JSON to disk and fall
back to that copy when downloading it fails. User cancellation is
still propagated, and cache read/write errors never break the
connection flow.
@Axionyxx

Copy link
Copy Markdown
Member

As per our guidelines, we do not accept pull requests made with LLMs.

Caching manifests also poses a security risk, and is not a solution we can accept.

@Axionyxx Axionyxx closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot connect to any server when the Robust builds CDN is unreachable, even with the engine already installed

2 participants