Skip to content

fix: concurrent map writes panic - #20

Merged
alec-w merged 1 commit into
cofide:mainfrom
glindstedt:push-vkzuwtmlowrk
Apr 7, 2026
Merged

alec-w merged 1 commit into
cofide:mainfrom
glindstedt:push-vkzuwtmlowrk

Conversation

@glindstedt

Copy link
Copy Markdown
Contributor

Ran into a concurrent map write panic so added an RWMutex to use when accessing the map

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces thread-safety to the WorkloadHandler by adding a sync.RWMutex to protect the svids map from concurrent access. The feedback suggests using a value type for the mutex instead of a pointer to follow Go idioms, which also simplifies the struct initialization.

Comment thread pkg/spire-devserver/workload.go Outdated
Comment thread pkg/spire-devserver/workload.go Outdated
@alec-w
alec-w self-requested a review April 7, 2026 14:40

@alec-w alec-w left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Thanks @glindstedt

@alec-w
alec-w merged commit 3ad7508 into cofide:main Apr 7, 2026
1 check passed
@glindstedt
glindstedt deleted the push-vkzuwtmlowrk branch April 7, 2026 15:18
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.

2 participants