Skip to content

Fix/void interrupted uploads - #26

Merged
wvcollenburg merged 2 commits into
masterfrom
fix/void-interrupted-uploads
Nov 23, 2026
Merged

wvcollenburg merged 2 commits into
masterfrom
fix/void-interrupted-uploads

Conversation

@wvcollenburg

Copy link
Copy Markdown
Owner

Fix: a broken-off media upload is void and deleted (1.9.2)

Problem

HyperCore lists an ISO from the moment it is created (POST /ISO), before any data has arrived. If an upload through HCM was interrupted (browser closed, connection dropped, backup service restarted), the half ISO stayed on the cluster with readyForInsert: false. It never became usable and had to be deleted by hand. Nothing was logged, so it was hard to tell a slow upload from a broken one.

Changes

  • Tracking: the backup service records each running upload in a new backup.media_uploads table (migration 060_media_uploads.sql) until it finishes.
  • Voiding on a break: when the stream breaks off before its Content-Length, the upload is void. A not-ready ISO is deleted. A disk image still converting (uploading-<name>) is deleted too. The request answers 502.
  • The dashboard passes the break on at once: gunicorn reports a closed browser connection as a normal end of the body. Before, the backup service then waited for the rest of the file. Now the dashboard raises on an early end and closes the stream to the backup service immediately.
  • Stall timeout: a browser that goes silent without closing is treated as gone after 5 minutes without data (dashboard and backup service).
  • Startup sweep: uploads that were still running when the backup service stopped are voided when it starts again. It retries while clusters are unreachable.
  • Logging: each upload's start, finish and failure is logged, with bytes received and duration.

Tested

  • Unit: test_an_iso_upload_that_breaks_off_is_void_and_deleted, test_uploads_left_by_an_earlier_run_are_voided_at_start, test_a_browser_that_breaks_off_breaks_the_stream_to_the_backup_service. The full suite passes locally and in a clean python:3.12-slim container with only tests/requirements.txt.
  • Live on WDvCN11 with a 572 MiB ISO:
    • Client closes the connection at 191 MiB: the half ISO was deleted 12 s in.
    • docker restart sc_backup mid-upload: the half ISO was removed by the startup sweep within 45 s.
    • A complete upload still succeeds; nothing is left in backup.media_uploads.
  • Not tested live: the disk-image (uploading-<name>) path. It has unit tests only.

Upgrade notes

Migration 060 adds one table; no other changes to existing data.

William David van Collenburg added 2 commits November 22, 2026 23:28
HyperCore lists an ISO from its creation on, so an interrupted upload left an
ISO that never became ready. The backup service now tracks each running upload
(backup.media_uploads, migration 060) and voids it when the stream breaks:
the not-ready ISO, or the uploading-<name> disk, is deleted. The dashboard
breaks the stream to the backup service as soon as the browser's body ends
early, instead of passing it on as a normal end (which left the backup
service waiting for its stall timeout). Uploads still running when the
service stopped are swept at start. Start, end and failure are logged.
@wvcollenburg
wvcollenburg merged commit ee8a0e5 into master Nov 23, 2026
3 checks passed
@wvcollenburg
wvcollenburg deleted the fix/void-interrupted-uploads branch November 23, 2026 07:46
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