Skip to content

BUG: Race condition in folderEmails map access without synchronization #860

@andrinoff

Description

@andrinoff

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

  1. Rapidly switch folders while emails are being fetched
  2. Run with -race flag to detect

Expected behavior

Access to m.folderEmails should be protected by a mutex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersneeds-responseWaiting on issue author replystaleNo activity for extended period

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions