Skip to content

eeg-viewer: superseded and closed mounts leave zarr fetches in flight #208

Closed

Description

@neuromechanist

Surfaced during review of #206 (PR #206).

Problem

src/lib/eeg-viewer/store.ts contains no AbortController anywhere. Every range request it issues against zarr.nemar.org runs to completion regardless of whether anyone still wants the result.

That happens on ordinary interactions, not just edge cases:

  • Opening file A, then switching to file B before A's store finishes opening. A's requests keep streaming; the response is parsed and discarded.
  • Closing the viewer modal mid-load. Same.
  • Switching channel groups while a window read is in flight.

Why it is worth fixing separately

#206 fixed the correctness half of this: a superseded mount now bails via an isStale predicate before it can clobber the slot, so those responses no longer resurrect a dead viewer or orphan a live one. What remains is purely wasted work — bandwidth, Worker subrequests, and client CPU spent decoding chunks nobody will look at.

On a large montage the discarded read is not small, and a user skimming several recordings on one dataset page can stack up a few of these in a row.

Ask

Thread an AbortSignal through openRecording and the window/overview reads in store.ts, and abort it from the viewer's existing teardown path (destroy()), which already unwinds observers, listeners, and the WebGL context. The sequencing state needed to decide when to abort already exists: renderSeq inside the viewer, and eegModalSeq / isStale at the mount boundary.

Note the byte-transfer caveat that applies elsewhere in this repo does not apply here: these are bounded chunk reads for a view the user has navigated away from, not a long-running user-initiated transfer, so aborting them is correct rather than hostile.

Activity

  1. added
    enhancement
    on Jul 29, 2026
  2. neuromechanist commented on Sep 3, 2026

    @neuromechanist
    ContributorAuthor

    Fixed in #281 (staging commit a02b4b3); ships with the next staging promotion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions