Files
beads/cmd/bd/daemon_debouncer.go
Steven Syrek 8e40018701 fix(daemon): Fix double-unlock risk in debouncer on action panic (#1140)
The debouncer's timer callback used a pattern that could cause a
double-unlock panic if the action function panicked:

  d.mu.Lock()
  defer d.mu.Unlock()
  if d.seq == currentSeq {
      d.mu.Unlock()  // Manual unlock
      d.action()     // If this panics...
      d.mu.Lock()    // ...this never runs
  }                  // ...but defer still tries to unlock

Fix: Remove the defer and manually manage lock state. Now if the
action panics, the lock is already released, preventing a
double-unlock panic that would mask the original panic.

Co-authored-by: Steven Syrek <steven.syrek@deepl.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:08:53 -08:00

1.7 KiB