matcha
matcha copied to clipboard
BUG: Race condition in folderEmails map access without synchronization
Describe the bug
In markEmailAsReadInStores() (main.go:738-745), the code iterates over and modifies m.folderEmails map without any synchronization. This map is also accessed from goroutines in saveFolderEmailsToCache() (line 630) and fetchFolderEmailsCmd() (line 2426+), creating a data race.
To reproduce
- Rapidly switch folders while emails are being fetched
- Run with
-raceflag to detect
Expected behavior
Access to m.folderEmails should be protected by a mutex.
This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.
Closing due to inactivity. Reopen if still relevant.