matcha icon indicating copy to clipboard operation
matcha copied to clipboard

BUG: Cache corruption when concurrent folder updates occur

Open andrinoff opened this issue 7 months ago • 2 comments

Describe the bug: Folder cache and body cache can corrupt when multiple goroutines write simultaneously. No mutex protection around cache file writes in folder_cache.go and cache.go.

To reproduce:

  1. Enable multiple accounts
  2. Trigger simultaneous folder sync
  3. Both write to cache files concurrently
  4. JSON corruption or partial writes possible

Expected behavior: Synchronize cache writes with mutex or file locking.

Additional context:

  • Files: config/folder_cache.go, config/cache.go
  • No sync.Mutex around SaveFolders() or cache writes
  • Multiple accounts can trigger concurrent writes
  • Severity: High - data corruption
  • Complexity: High - needs thread-safe cache design

andrinoff avatar Apr 16 '26 20:04 andrinoff

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.

floatpanebot avatar May 17 '26 05:05 floatpanebot

Closing due to inactivity. Reopen if still relevant.

floatpanebot avatar May 31 '26 06:05 floatpanebot