Repository navigation
room-node: fix source sideFile HTTP status, prefetcher close/duplicate reads, fetchRange bounds, and localFileReader lanes/close race - #441
Open
Pybsama wants to merge 1 commit into
Conversation
…e reads, fetchRange bounds, and localFileReader lanes/close race
|
@Pybsama is attempting to deploy a commit to the nehanth's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Summary
Fixes four edge-case bugs in
packages/room-node/source.js:openModel()sideFile()HTTP error check:cfg()/tokJson()previously calledfetchImpl(url).then((r) => r.json())without checkingr.ok, returning HTTP 4xx/5xx JSON error bodies as config/tokenizer data. Now throwsError("fetch <status> for <url>")when!r.ok.rangePrefetcherclose(), duplicate planned reads, re-plan reset, andlen === 0:close()now clearsreads, decrementsheldfor buffered chunks, marks chunksdropped, and nullsc.pso settled chunk promises do not retain multi-GBUint8Arraybuffers after close.plan()resetsreadsandnext, and tracks planned reference counts peroff:lenkey so duplicate planned reads of the same range do not prematurely drop the chunk after the firstread().read(off, 0)returns an emptyUint8Array(0)and closed prefetchers returnnull.fetchRange()zero-length and invalid ranges: Validates0 <= start <= end(finite) and returnsnew Uint8Array(0)immediately whenend === startinstead of sending an invalidRange: bytes=0--1HTTP request.localFileReaderlanesclamping and concurrentclose()duringopen(): Clamps non-positive/non-finitelanesto>= 1(preventingTypeError: Reduce of empty array with no initial value) and closes + rejects withreader is closedifclose()occurs whilefs.promises.open()is still pending.Verification
packages/room-node/test/source_test.mjs(all 4 failed RED before fix, passed after fix).node --check packages/room-node/source.js packages/room-node/test/source_test.mjs— clean.node --test packages/room-node/test/source_test.mjs—13 pass, 0 fail.npm run test:packages—217 pass, 0 fail, 6 skipped.npm run test:runtime—protocol: 4, 6/6 checks passed (172frames).