Blog
Debugging Is Controlled Hypothesis Testing
Random changes sometimes make a bug disappear. They also destroy evidence and teach little about the next occurrence. Reliable debugging treats each action as an experiment designed to distinguish between competing explanations.
First, make the symptom precise. Which request, input, version, environment, and time window fail? What should happen, and what happens instead? “The service is slow” becomes useful only after latency is tied to an endpoint, percentile, region, dependency, or resource condition.
Build a timeline before building a theory. Compare deploys, configuration changes, traffic shifts, dependency events, and the first known failure. Correlation is not causation, but it narrows the search and prevents memory from rewriting the sequence.
Write down a small set of hypotheses with predicted observations. If connection exhaustion is responsible, active connections should approach the pool limit and request wait time should rise. If CPU saturation is responsible, a profile should show where execution time accumulates. Seek evidence that can disprove a favored theory, not only evidence that fits it.
Change one meaningful variable when possible. Reproduce with a reduced input, route a controlled traffic slice, compare healthy and unhealthy instances, or inspect a captured state. Preserve artifacts such as logs, traces, heap dumps, and configuration revisions before restarting the process.
Track attempted actions and outcomes. This is essential during handoffs and incidents, where repeated experiments waste the most time. The coordination practices in an incident commander protects the debugging team make this shared state explicit.
After finding the cause, add a regression test or operational signal at the narrowest useful boundary. Then ask why detection and diagnosis took as long as they did. A fix removes one defect; improved observability and a repeatable method shorten an entire class of future failures.