Repository navigation
fix(studio-server): signing a project with a large folder keeps no record per file - #9129
Open
miguel-heygen wants to merge 2 commits into
Open
miguel-heygen wants to merge 2 commits into
miguel-heygen wants to merge 2 commits into
Conversation
Collaborator
Author
|
What the changed signature costs on update
|
Contributor
Edit accuracy: accurate 275 (base branch 273), smooth 73 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
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.
What
Signing a project no longer keeps a record per file.
createProjectSignatureandcreateProjectSignatureAsyncfold each file into the signature as the walk reaches it, and the awaited walk stats at most 64 entries of a folder at a time.Why
Both walks collected one record for every file, then sorted and hashed them all at the end. The awaited walk also started an
lstatfor every entry of a folder at once. A project whoseframes/folder holds tens of thousands of stills (an agent rendering a sequence does this) cost hundreds of MB to sign: heap grew by 22 MB at 10,000 files, 126 MB at 50,000 and 360 MB at 150,000 (Node 22, awaited walk). Hosts that sign on every preview or thumbnail request paid that on each one.Related work
None.
How
walkProject/walkProjectAsync). Each folder's names are sorted, the walk goes depth first, then the two Studio manifests follow. Both walks visit files in the same order, so they still return the same signature.SignatureFoldtakes each file as it arrives. The fingerprint (path, size, mtime, ctime, text or binary) and every binary file go straight into their hashes. Only text-eligible files are kept, because their content is read after the walk, and only when the fingerprint is not cached. The settled-before-signing check keeps the newest time instead of scanning a list.STAT_BATCH) instead of all its entries in onePromise.all.listProjectFilesAsyncuses the same walk. It still returns its full list, as its callers need.localeComparesort of every path, and binary files are hashed before text files. A host's cache keyed on the old value rebuilds once.Test plan
projectSignature.memory.test.tssigns a project with a 50,000-fileframes/folder served from a mockednode:fs(no disk, so it is quick on every OS). It forces GC and samples the heap during the walk. "the synchronous walk keeps no record per file" and "the awaited walk keeps no record per file and stats a bounded number of entries at once" both fail on main: 168 bytes per file retained, and 50,000 stat calls in flight. With the change they read about 10 bytes per file and 64 in flight. Two deliberate breaks each fail them: an unbounded batch, and keeping every entry in a list. The test passes 3 runs in a row.projectSignature.test.tspasses unchanged, including "returns the signature the synchronous walk returns". The wholestudio-serversuite passes: 2,785 tests, 6 skipped.