matcha
matcha copied to clipboard
BUG: Potential goroutine leak in IDLE watcher cleanup
Describe the bug In fetcher/idle.go, Watch() creates goroutines but comment "Let old connection tear down in the background" suggests goroutines may not be properly waited on, risking leaks if connections don't close cleanly.
To reproduce Examine fetcher/idle.go lines 48-60:
// Stop existing watcher for this account if any
if existing, ok := w.watchers[account.ID]; ok {
close(existing.stop)
delete(w.watchers, account.ID)
// Let old connection tear down in the background
}
If old connection hangs, goroutine never exits.
Expected behavior Use WaitGroup or ensure goroutines terminate within timeout.
Additional context
- Good first issue
- StopAllAndWait() exists but only called on shutdown
- Long-running background goroutines can accumulate
Suggested fix: Add timeout-based cleanup or WaitGroup tracking.
OS All platforms
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.