Skip to content

bug: frontend: streaming progress handlers lose events since axios 1.x #4664

Open

Description

@joaoantoniocardoso

Bug description

Since axios 1.x, the streaming progress handlers read the stream body from progressEvent.event.currentTarget.response. axios 1.12.2 throttles onDownloadProgress to 3 calls per second (lib/helpers/progressEventReducer.js + lib/helpers/throttle.js): only the first event, or one arriving at least 333 ms after the previous call, runs while the browser is dispatching it. The others run later from a setTimeout, and the last one from flush() in done() (lib/adapters/xhr.js). By then the DOM has already reset event.currentTarget to null. event.target (the XHR) stays set and keeps the growing response.

On axios 0.21 the callback ran synchronously with the raw event, so this worked before the axios bump.

With a server that streams a chunk every 100 ms, only the first callback had a currentTarget, the other 19 got null, while event.target.response had the data every time.

Affected on master:

  • core/frontend/src/utils/pull_tracker.ts:150, digestNewData returns early when currentTarget is null. It feeds extension install, update and upload finalize (ExtensionManagerView.vue), BlueOS image pulls and the Major Tom install (VersionChooser.vue, CloudTrayMenu.vue).
  • core/frontend/src/components/version-chooser/VersionChooser.vue:525, the Major Tom progress guard skips the same events.
  • core/frontend/src/views/SettingsView.vue:707 and :761, log deletion reads progressEvent.event.currentTarget.response without a null check and throws TypeError: Cannot read properties of null from the throttle timer.
  • core/frontend/src/store/disk.ts:198, the disk speed test drops a result that arrives within 333 ms of the previous one.

Steps to reproduce

  1. Install or update an extension, or pull a BlueOS version, on a link where the pull output arrives faster than every 333 ms.
  2. Watch the pull progress: it shows the first chunk and then only updates when the stream pauses for 333 ms or more.
  3. In Settings, delete the system or MAVLink logs and check the browser console: TypeError: Cannot read properties of null (reading 'response').

Primary pain point(s)

  • Pull progress freezes during installs and updates.
  • The pull tracker reports errors from the streamed fragments, so an error in a burst at the end of a stream can be lost and the install looks successful.
  • The log deletion status stops updating.

Additional context

Same on 1.4 once the axios 1.12.2 backport (#4650) lands.

Fix: read event.target.response in these handlers.

Prerequisites

  • I have checked to make sure that a similar request has not already been filed or fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingtriageNeeds triage from developersuiUser Interface feature

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions