fix

Go goroutine leak cpu

Go goroutine leak cpu is typically caused by a compute-bound bottleneck where one or more processes are saturating CPU cores. Here is what to look for and what to do about it.

Common symptoms

Likely causes

Evidence to look for

pprof shows growing goroutine count
blocked goroutines accumulating on channel ops
GC pressure increasing with goroutine count

What it usually means

When CPU is the true bottleneck, the fix is usually profiling the hot path and reducing compute work. Scaling horizontally or vertically without profiling first is wasteful.

What to do next

  1. 1use runtime/pprof to dump goroutine stacks
  2. 2check for goroutines blocked on unbuffered channels
  3. 3add context cancellation to long-running goroutines

See what's causing your CPU

cpum.ai turns CPU, process, disk, and memory signals into plain-English explanations with evidence.

Open cpum.ai

Related

Go goroutine leak cpu: causes and fixes | cpum.ai