Upload client: buffering, fixed timeout, partial files #9

Closed
opened 2026-10-07 20:04:27 -04:00 by jared · 0 comments
Owner

Source: engineering review, 2026-10-07.

web/src/connection.js uploadFile has three weaknesses:

  • It buffers and base64-encodes the whole file before the 25 MB check, so a dropped ISO can crash the tab.
  • The timeout is a fixed total, so slow links (under ~0.5 Mbit/s) fail.
  • A disconnect SIGHUPs the server and leaves a partial file, because there's no cleanup trap.

Fix: check file.size first, stream with file.slice, use an idle timeout, and add a trap in cmd_upload that removes the partial file.

_Source: engineering review, 2026-10-07._ `web/src/connection.js` `uploadFile` has three weaknesses: - It buffers and base64-encodes the whole file before the 25 MB check, so a dropped ISO can crash the tab. - The timeout is a fixed total, so slow links (under ~0.5 Mbit/s) fail. - A disconnect SIGHUPs the server and leaves a partial file, because there's no cleanup trap. **Fix:** check `file.size` first, stream with `file.slice`, use an idle timeout, and add a `trap` in `cmd_upload` that removes the partial file.
jared added this to the v0.5.0 hardening + header/phone milestone 2026-10-07 20:04:27 -04:00
jared added the bug label 2026-10-07 20:04:27 -04:00
jared closed this issue 2026-10-07 20:15:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/devdesk#9