Skip to content

Viewer: abort unread chunk responses on HTTP errors - #8040

Open
coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:fix/viewer-abort-http-error-chunks
Open

coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:fix/viewer-abort-http-error-chunks

Conversation

@coenflict

Copy link
Copy Markdown

Claimed in coordination issue #7913.

What and why

The viewer clears a chunk's download timeout and releases its slot when a response has an unsuccessful HTTP status. The error body can still be downloading. Abort that unread body when rejecting the response so it stops before the viewer releases the slot. The existing retry backoff still applies.

Tested

Windows 11, Node.js 24.22.1 and CPython 3.14.7. The viewer tests use synthetic data and run without a GPU.

  • The new HTTP 503 regression failed against origin/main at dde82f27e because the request signal stayed active. It passed after the fix and verified that the retry starts after backoff and loads the chunk.
  • node --test tests/test_viewer_streaming.cjs tests/test_viewer_studio.cjs passed 66 of 67. The camera-speed test reproduces the same missing AbortController error on origin/main. All 67 passed in a temporary copy with the existing camera-test fix from test_viewer_streaming: fix the false failure in the Shift-camera sandbox (missing AbortController) #7063 applied.
  • python -I tests/test_viewer_serve.py passed 38 tests with one skip. Python compilation, the No Game Data check on both changed files and git diff --check passed.

AI-assisted with Codex.

Checklist

  • No game data, keys or decryption.
  • Added a synthetic regression and verified the failure before the fix and the pass after it.

@TieruYT

TieruYT commented Nov 23, 2026

Copy link
Copy Markdown

Windows, synthetic inputs. Tested 276b500.

On Node 25.1.0 the HTTP-error regression passed on this revision and failed when I substituted the parent viewer. The full module was 57/58 on the PR and 56/58 with the parent viewer. The separate failure is reproducible on both: the Shift/Ctrl camera-speed test initializes loadWorld in a VM without AbortController. Adding AbortController, setTimeout and clearTimeout to that test's context made the full module pass 58/58 locally, with the viewer code untouched.

AI-assisted verification · GPT-6.2 Astra Medium

@xDeadXD

xDeadXD commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 276b500e5 on Windows 11 2024 IoT LTSC (Node v26.13.0, CPU-only, no game files): pass

  • At PR head 276b500e5 and merged onto main 6312c057f (clean merge): node --test tests/test_viewer_streaming.cjs → 57 passed, 1 failed (the new an HTTP error aborts the unread chunk response before retrying test passes; the 1 failure is Shift speeds the camera up and Ctrl slows it down, on either side of the keyboard with ReferenceError: AbortController is not defined, which also fails on unmodified main 6312c057f at 56 passed, 1 failed).
  • Negative control (PR test file checked out onto main 6312c057f without viewer/index.html change): an HTTP error aborts the unread chunk response before retrying fails as expected.
  • python -B -I scripts/check_no_game_data.py viewer/index.html tests/test_viewer_streaming.cjs → clean; git diff --check origin/main → clean.

AI-assisted.

@yahohu77 yahohu77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Windows check of 276b500e5 (Node 24.19.0, CPython 3.12.10, no game data):

  • Negative control: with only viewer/index.html reverted to base 867d922f, the new test fails exactly as intended — AssertionError: abort the download when rejecting the response (false !== true). With the PR's index.html it passes. So the regression test really covers the fix.
  • node --test tests/test_viewer_streaming.cjs tests/test_viewer_studio.cjs: 66/67 pass. The single failure is the pre-existing camera-speed test (ReferenceError: AbortController is not defined), the same one your report attributes to #7063; no new failures.
  • python -I tests/test_viewer_serve.py: 39 tests, OK (2 skips on this Python version).
  • python -I scripts/check_no_game_data.py viewer/index.html tests/test_viewer_streaming.cjs: clean.

Code read: aborting the controller before throwing is the right order — the finally releases the slot only after the signal is already aborted, so a late error body cannot keep the download alive. The retry backoff is unchanged. No issues found from my side.

AI-assisted: run and summarised by an OpenCode session; numbers are from local logs.

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.

4 participants