test(api): add parallel-session stress test (I2)#92
Merged
Conversation
Wires up Track I2 from the v1.6.5->1.7 readiness taskboard. Drives 32 independent DocumentSession instances on a fixed-size thread pool through 4 iterations to catch race conditions in process-wide shared state (font registry, glyph cache, built-in node definitions, shape outline cache). Two assertions: 1. identicalSessionsInParallelProduceIdenticalLayoutGraphs: every parallel render produces the same layout-graph toString() as a sequential baseline. Catches any shared mutable state racing in the prepare/measure pipeline. 2. independentSessionsInParallelProduceValidPdfBytes: every PDF carries the %PDF magic, is at least 256 bytes, and size variance across threads is <256 bytes (loose enough not to lock against legitimate timestamp drift, tight enough to catch corruption). Each DocumentSession is single-threaded by contract; this test exercises a fleet of INDEPENDENT sessions, not concurrent access to a single session. ~1.6s locally; does not bloat CI.
0a4237f to
554f343
Compare
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
Wires up Track I2 from the v1.6.5→1.7 readiness taskboard. Drives 32 independent
DocumentSessioninstances on a fixed-size thread pool through 4 iterations to catch race conditions in process-wide shared state (font registry, glyph cache, built-in node definitions, shape outline cache).Two assertions
identicalSessionsInParallelProduceIdenticalLayoutGraphslayoutGraph().toString()as a sequential baseline. Catches any shared mutable state racing in the prepare / measure pipeline.independentSessionsInParallelProduceValidPdfBytes%PDFmagic, is at least 256 bytes, and size variance across threads is < 256 bytes — loose enough not to lock against legitimate timestamp drift, tight enough to catch corruption.Why this scope
Each
DocumentSessionis single-threaded by contract — the stress test exercises a fleet of independent sessions, each owned by exactly one thread, not concurrent access to a single session. The guarantee under test is that the process-wide machinery (default font registry, glyph cache, built-in node definitions, shape outline cache) handles concurrent lookup safely.Future-direction note: when Track I3 (
DocumentSession.registry()immutable view, planned for 1.6.7) lands, this stress test will validate that the new contract continues to hold under concurrency.Verification
128 layout renders + 128 PDF renders = 256 concurrent operations complete in ~1.6 s. Does not bloat CI.
Full suite re-run also green:
CHANGELOG entry added to
v1.6.6 — Plannedunder### Build.Test plan
Executors.newFixedThreadPool(32)+invokeAll+ assertions)registry()view