Skip to content

fix: protect providers map#1268

Merged
andrinoff merged 2 commits into
floatpane:masterfrom
mavonx:fix/issue-766
May 11, 2026
Merged

fix: protect providers map#1268
andrinoff merged 2 commits into
floatpane:masterfrom
mavonx:fix/issue-766

Conversation

@mavonx
Copy link
Copy Markdown
Contributor

@mavonx mavonx commented May 10, 2026

What?

Protected the providers map with a sync.RWMutex to fix a race condition.

Why?

ensureProviders() writes to the map on the Bubble Tea event loop while getProvider() is called concurrently from goroutines spawned by batch and search commands, causing unsafe concurrent map access.

Closes #766

@mavonx mavonx requested a review from a team as a code owner May 10, 2026 19:24
@floatpanebot floatpanebot added the bug Something isn't working label May 10, 2026
Comment thread main.go Outdated
Comment on lines +181 to +182
m.providersMu.RLock()
defer m.providersMu.RUnlock()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mavonx shouldn't this be after checking the acct == nil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, I will handle this right now.

@mavonx mavonx requested a review from andrinoff May 10, 2026 20:35
Copy link
Copy Markdown
Member

@andrinoff andrinoff left a comment

Choose a reason for hiding this comment

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

lgtm

@andrinoff andrinoff merged commit 2aa2812 into floatpane:master May 11, 2026
13 checks passed
@mavonx mavonx deleted the fix/issue-766 branch May 11, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Provider map race condition in main model

3 participants