Skip to content

arigl-web: a download that breaks off is fetched again past the cache, and a failure names the file - #1505

Merged
transfix merged 1 commit into
masterfrom
fix/arigl-web-download-retry
Nov 24, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/arigl-web-download-retry

Conversation

@transfix

Copy link
Copy Markdown
Owner

On https://transfix.github.io/grl-snam-demos/scrub/, Firefox shows this on every load:

Could not start: Error in input stream
document: https://transfix.github.io/grl-snam-demos/scrub/main.py
(ariglx printed nothing)

Why

  • The page's loader fetches ariglx.wasm (105.6 MB, served gzip at 30.3 MB) and python312.zip itself, with cache: 'no-cache' and no retry. "Error in input stream" is Firefox's message for a response body that broke off.
  • I reproduced it in Firefox 158 (headless, over Marionette) against the live site:
    • a load cut off mid-download leaves a partial copy of ariglx.wasm in Firefox's HTTP cache;
    • the next load resumes that copy, and the body breaks: ariglx.wasm broke off at 23604869: Error in input stream;
    • the same fetch with cache: 'reload' gets the whole file.
  • It's intermittent. With the patched download logic on the live origin, 1 of 6 rounds hit it, and that round recovered on the reload retry. Chromium never showed it.
  • Same file, same size, but GitHub Pages' servers give python312.zip different ETags ("6b045ef8-da5bad" / "6b045ecd-da5bad"). That may be what spoils the resume. I couldn't confirm it: a proxy with two alternating ETags didn't reproduce it.

What changes

  • src/arigl/web/arigl-web.js:
    • Retry: each file is first fetched with cache: 'no-cache', as before. A fetch that fails, or whose body breaks off or ends short of its Content-Length, is retried twice more, 0.5 s and 1 s later, with cache: 'reload'. That fetch bypasses the cache and replaces the copy there.
    • No retry on refusal: a 404 or other refusal fails at once, as before.
    • The error names the file: if the file still breaks, the error says which file, how far it got, and the browser's own message: Could not start: downloading ariglx.wasm broke off after 23.6 MB, 3 tries (Error in input stream). Reload the page to try again; if it keeps failing, clear this site's data.
    • Progress: the status line says (again: ariglx.wasm) while a file is retried.
    • Pre-existing bug fixed: when one file failed, the other's progress kept overwriting the error, so a 404 left "Downloading … MB" on screen. Now the other downloads are aborted and the error line stays.
  • src/cvc/ariadne/web_document.cpp: arigl's own fetches (the document, the files it names, the preload) retry the same way. Any reply the server gives is still returned as it came.
  • Docs: ARIADNE.md §9.4 and CVCGL_WASM.md ("A download that breaks off").

Tests

  • src/arigl/web/test/arigl_web_download.mjs (new): the loader in headless Chrome, with a stand-in module and no wasm build, so it takes seconds. Cases:

    • a clean load;
    • a .wasm and a zip each cut off once: fetched again with reload, and the page runs;
    • a .wasm cut off every time: the error names it and its size;
    • a 404: no retry.

    All 5 pass locally (Chrome for Testing 145). Against master's loader, 4 of 5 fail. Chrome's version of the error is "network error". CI runs this test in the arigl-web job right after the toolchain install, before the wasm build.

  • arigl_web_smoke.mjs: a new /apps/flaky/ case, whose preload is cut off half-way the first time. The page must fetch it again with reload and run. This needs the wasm build, so it runs only in CI, for both arigl-web and ariglx-web.

Getting it onto the demo site

transfix/grl-snam-demos builds from a pinned libcvc tag (pages.yml's LIBCVC_REF, v4.0.0 now). The fix reaches the site after a libcvc release carries it and that ref moves.

Until then, the workaround in Firefox is to clear the site's data for transfix.github.io (padlock → Clear cookies and site data). That drops the partial copy.

…, and a failure names the file

On https://transfix.github.io/grl-snam-demos/scrub/ Firefox showed "Could not start: Error in
input stream (ariglx printed nothing)" on every load. Reproduced in Firefox 158 against the live
site: a load cut off mid-download leaves a partial copy of ariglx.wasm in Firefox's cache, and
the next load's resume of it breaks ("broke off at 23604869: Error in input stream"); a fetch with
cache: 'reload' gets the whole file.

- arigl-web.js: the module's .wasm and the Python zip are fetched with cache: 'no-cache' as
  before; a fetch that fails or whose body breaks off (or ends short of its Content-Length) is
  asked twice more, 0.5 s and 1 s later, with cache: 'reload'. A server's refusal (404) is not
  retried. A file that still breaks fails the page with its name, how much arrived and the
  browser's words: "downloading ariglx.wasm broke off after 23.6 MB, 3 tries (Error in input
  stream). Reload the page to try again; ...". The other downloads stop, and their progress no
  longer overwrites the error line (it did before: a 404 left "Downloading ... MB" showing).
- web_document.cpp: arigl's own fetches (the document, the files it names, the preload) retry
  the same way.
- arigl_web_download.mjs (new): the loader in headless Chrome with a stand-in module, no wasm
  build: a clean load, a .wasm and a zip cut off once (fetched again with reload, the page runs),
  a .wasm cut off every time (the error names it and its size), a 404 (no retry). Against
  master's loader four of the five fail. CI runs it in the arigl-web job before the wasm build.
- arigl_web_smoke.mjs: /apps/flaky/, a preload cut off half-way the first time; the page must
  fetch it again with reload and run.
- ARIADNE.md section 9.4 and CVCGL_WASM.md: what the page and arigl do with a broken download.
@transfix
transfix enabled auto-merge (squash) November 23, 2026 23:49
@transfix
transfix merged commit fd9c7d4 into master Nov 24, 2026
30 of 31 checks passed
@transfix
transfix deleted the fix/arigl-web-download-retry branch November 24, 2026 03:58
transfix added a commit that referenced this pull request Nov 24, 2026
… ...) into p9/volume-grid-segment

#1464 checks every load against the closed schema, which already takes a
color picker's fmt: rgb | hex. ColorWidgetFmtHexDrawsTheHexPicker counted
every warning of its fmt: hsv load; it now counts the loader's own, as
#1464's loader tests do, and checks that the schema flags that fmt where
it is when the validator is built in.
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.

1 participant