Skip to content

schema: guard schemaCache map with mutex to fix data race - #11

Merged
phaus merged 1 commit into
mainfrom
fix/schema-cache-race
Sep 4, 2026
Merged

schema: guard schemaCache map with mutex to fix data race#11
phaus merged 1 commit into
mainfrom
fix/schema-cache-race

Conversation

@phaus

@phaus phaus commented Sep 4, 2026

Copy link
Copy Markdown
Member

Load writes the package-level schemaCache map while Validate reads it via schemaForType. If Load runs concurrently with request validation (or is called twice concurrently), this is a concurrent map read/write race.

Guard access with a sync.RWMutex so writes in Load and reads in schemaForType are properly serialized.

Load writes the package-level schemaCache map while Validate reads it via
schemaForType. If Load runs concurrently with request validation (or is
called twice concurrently), this is a concurrent map read/write race.

Guard access with a sync.RWMutex so writes in Load and reads in
schemaForType are properly serialized.
@phaus
phaus merged commit 6ed76e2 into main Sep 4, 2026
@phaus
phaus deleted the fix/schema-cache-race branch September 4, 2026 09:05
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