fix: invalidate in-flight fillCache work on idle()/dispose() - #48
Open
PriyeshPandey2000 wants to merge 1 commit into
Open
fix: invalidate in-flight fillCache work on idle()/dispose()#48PriyeshPandey2000 wants to merge 1 commit into
PriyeshPandey2000 wants to merge 1 commit into
Conversation
idle() and dispose() tear down the iterator/cache/queue without bumping seekGeneration, so a fillCache already in flight never notices — it reads next() off the now-nulled iterator (crash) or inserts a decoded frame into the disposed cache, resurrecting the canvas backing store dispose() was meant to free. Same shape in sequence.ts. Bump seekGeneration in idle()/dispose() in both files, matching the existing pattern at scrubTo/exactSeekTo. Add a regression test that reproduces the exact crash pre-fix.
|
@PriyeshPandey2000 is attempting to deploy a commit to the Diffusion Studio Team on Vercel. A member of the Team first needs to authorize it. |
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
VideoBuffer.idle()/dispose()(video.ts) andSequenceDecoder.idle()/dispose()(sequence.ts) tear down the iterator/cache/queue without bumpingseekGeneration. Every other mutation site (scrubTo,exactSeekTo) increments it — these two don't, so afillCachealready in flight never notices the teardown happened.fillCache's loop re-readsthis.iteratoreach iteration; if idle()/dispose() lands mid-await and nulls it, the generation check that should catch this passes (unchanged), so the loop calls.next()onnull→TypeError: Cannot read properties of null (reading 'next').frameCallback→cache.insert()afterdispose().FrameCache.insert()→resizeCaches()resurrects the atlas/source canvasesdispose()explicitly zeroed out to free — undoing the teardown.seekGenerationinidle()/dispose()in both files, same pattern already used at the two seek entry points.video.test.ts) reproducing the exact crash — fails with the reportedTypeErrorpre-fix, passes post-fix.Test plan
cd packages/runtime && npx vitest run— 2/2 pass, reproduces the exact reported TypeError pre-fix on unpatched codenpx tsc --noEmit— clean (one pre-existing unrelated error inpackages/assets)