[hub] Fix stale abort listener terminating pooled sha256 workers - #2325
Merged
coyotte508 merged 1 commit intoJul 28, 2026
Merged
Conversation
coyotte508
approved these changes
Jul 28, 2026
Contributor
Author
|
The red CI looks unrelated to this PR: Happy to move the test or reshape it if you'd rather it lived somewhere else. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2311.
The abort listener in the pooled web-worker path is only removed when it fires, so a successful hash leaves it attached to the caller's signal. When that signal aborts later — one signal usually covers a whole multi-file commit, so this is the ordinary case — the listener runs against an operation that already finished and:
freeWorkeralready returned topendingWorkersAbortErrorcleanup()now removes the abort listener too, so every exit path — success, worker error, non-hash message, abort — drops it in one place.The test drives the pooled path with a stand-in
Worker(Node has no global one), completes a hash, then aborts. Without the fix it fails on the terminate count and throws an unhandledABORT_ERR. It's excluded from the browser config for the same reasonuploadShards.spec.tsis —vi.mock.One thing I noticed but left alone:
destroyWorkeronly deletes fromrunningWorkers, so a worker terminated while sitting inpendingWorkersstays in the pool andgetWorkerhands it to the next caller. Nothing reaches that state with this fix in place, but happy to harden it separately if you'd like.Note
Low Risk
Targeted fix to frontend sha256 worker cleanup with a focused unit test; no auth, data, or API surface changes.
Overview
Fixes a lifecycle bug in the pooled web-worker
sha256path where theabortlistener stayed on the caller’sAbortSignalafter a hash finished successfully.cleanup()now removes that listener on every exit (success, worker error, abort), so a later abort—typical when one signal covers a multi-file commit—no longer terminates a worker already returned to the pool or rejects an already-settled async generator.Adds a Node-only regression test with a fake
Workerand excludes it from the browser Vitest config (same pattern asuploadShards.spec.tsforvi.mock).Reviewed by Cursor Bugbot for commit 21e9cd2. Bugbot is set up for automated code reviews on this repo. Configure here.