Skip to content

fix(store): guard abort on request supersession#313

Merged
mihar-22 merged 1 commit intomainfrom
fix/store-queue-hang
Jan 19, 2026
Merged

fix(store): guard abort on request supersession#313
mihar-22 merged 1 commit intomainfrom
fix/store-queue-hang

Conversation

@mihar-22
Copy link
Copy Markdown
Member

Summary

  • Add abortable utility to race promises against abort signals
  • Wrap queue handlers and store guards with abortable to ensure immediate rejection on supersession
  • Fix hanging guards when requests are rapidly superseded (e.g., seek scrubbing)

Problem

Guards and handlers may not respect the abort signal. If a request is superseded while waiting in a guard (e.g., waiting for canplay), the guard promise could hang forever:

store.request.seek(10);  // waiting in guard for HAVE_METADATA...
store.request.seek(20);  // supersedes first request
// First request's guard was still waiting, holding references

Solution

The abortable(promise, signal) utility races any promise against an abort signal, guaranteeing immediate rejection regardless of whether the guard/handler implementation checks the signal.

Behavior Change

Abort errors now carry the original reason (SUPERSEDED, ABORTED) rather than always being ABORTED. This provides more accurate error information—callers can now distinguish "user cancelled" from "superseded by newer request."

Test Plan

  • 7 new tests for abortable utility
  • All 257 store tests pass
  • All 154 utils tests pass

Add `abortable` utility to race promises against abort signals,
ensuring guards and handlers reject immediately when superseded.

Previously, guards that didn't check the abort signal could hang
indefinitely when a request was superseded (e.g., rapid seek scrubbing).

Behavior change: Abort errors now carry the original reason (SUPERSEDED,
ABORTED) rather than always being ABORTED. This provides more accurate
error information to callers.
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Review Updated (UTC)
vjs-10-demo-html Ignored Ignored Jan 19, 2026 2:56pm
vjs-10-demo-next Ignored Ignored Jan 19, 2026 2:56pm
vjs-10-demo-react Ignored Ignored Jan 19, 2026 2:56pm
vjs-10-website Skipped Skipped Jan 19, 2026 2:56pm

Request Review

@mihar-22 mihar-22 merged commit e643ee1 into main Jan 19, 2026
7 checks passed
@mihar-22 mihar-22 deleted the fix/store-queue-hang branch January 19, 2026 14:58
@github-actions github-actions bot mentioned this pull request Jan 19, 2026
This was referenced Feb 26, 2026
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
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