Skip to content

fix(apijson): protect union registry with sync.Map to prevent concurrency write panics - #4349

Open
Vishhh03 wants to merge 1 commit into
cloudflare:mainfrom
Vishhh03:fix-raceCondition-unionRegistry
Open

Vishhh03 wants to merge 1 commit into
cloudflare:mainfrom
Vishhh03:fix-raceCondition-unionRegistry

Conversation

@Vishhh03

Copy link
Copy Markdown

Fixes: #4326

Summary

This change replaces the global unionRegistry and unionVariants maps with sync.Map and updates all read/write access sites to use the thread-safe Load and Store methods.

This prevents concurrent map write panics when RegisterUnion() is called from multiple goroutines.

Testing

Ran the existing test suite locally and all tests passed.

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Change from to a thread safe map version or usage mutex was requested.

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.

Race Condition Issue : Protect union registry with sync.Map to prevent concurrent write panics (race condition)

1 participant