Skip to content

fix(syntax): keep pack loads off the grammar store lock - #62

Merged
seatedro merged 1 commit into
masterfrom
rohit/syntax-store-lock
Nov 3, 2026
Merged

seatedro merged 1 commit into
masterfrom
rohit/syntax-store-lock

Conversation

@seatedro

@seatedro seatedro commented Nov 3, 2026

Copy link
Copy Markdown
Owner

A frame could stall while the highlight worker loaded an unrelated grammar pack, because every store lookup held the store's lock across hashing, opening and compiling a pack, and the diff view asks the store for a language's status on the UI thread. Resolving now has its own lock and touches the state lock only for map updates, the diff view uses a new non-resolving GrammarStore::resolved read, the catalog checks installed files outside the lock, and a failed fetch-thread spawn marks the tag unavailable instead of re-locking the state its caller held.

Every lookup held the store's state lock while it resolved a tag, which
covers hashing a pack's files, opening its library and compiling its
queries. The diff view asks the store for a language's status on the UI
thread when a highlight lands, so a frame could wait for a different
language's pack to load on the worker. If the fetch thread failed to
spawn, queuing re-locked the state that lookup still held.

Resolving now runs under a lock of its own and touches the state lock
only for map updates, so resolved tags answer at once while one tag
still loads once. The diff view reads the resolved status without
resolving, the catalog checks installed files outside the lock, and a
failed fetch-thread spawn is reported to the caller, which records the
tag as unavailable.
@seatedro seatedro closed this Nov 3, 2026
@seatedro seatedro reopened this Nov 3, 2026
@seatedro
seatedro enabled auto-merge November 3, 2026 12:43
@seatedro
seatedro merged commit 3339244 into master Nov 3, 2026
14 of 15 checks passed
@seatedro
seatedro deleted the rohit/syntax-store-lock branch November 3, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant