Skip to content

Patch unsafe producer map access#1236

Merged
brandur merged 1 commit intomasterfrom
brandur-unsafe-map-fix
May 1, 2026
Merged

Patch unsafe producer map access#1236
brandur merged 1 commit intomasterfrom
brandur-unsafe-map-fix

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented May 1, 2026

While doing a little work on #1235, my LLM flagged that the way that
we're accessing producersByQueueName today is already a little unsafe
as it may be read in multiple places concurrently. There's a mutex to
protect it somewhat in the QueueBundle, but it may still race between
a change there a "notify producer" send.

Here, add one additional RWMutex that makes sure to synchronize read
access on the map.

While doing a little work on #1235, my LLM flagged that the way that
we're accessing `producersByQueueName` today is already a little unsafe
as it may be read in multiple places concurrently. There's a mutex to
protect it somewhat in the `QueueBundle`, but it may still race between
a change there a "notify producer" send.

Here, add one additional `RWMutex` that makes sure to synchronize read
access on the map.
@brandur brandur force-pushed the brandur-unsafe-map-fix branch from 510d65b to d7c6bd8 Compare May 1, 2026 15:02
@brandur brandur requested a review from bgentry May 1, 2026 15:06
Copy link
Copy Markdown
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

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

ah, yeah map this was originally not being mutated outside initialization but that changed with the ability to add a new queue dynamically at runtime. Clearly we missed the concurrency safety around this! 🤖

@brandur
Copy link
Copy Markdown
Contributor Author

brandur commented May 1, 2026

ty!

@brandur brandur merged commit c6d65e5 into master May 1, 2026
15 checks passed
@brandur brandur deleted the brandur-unsafe-map-fix branch May 1, 2026 17:59
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