🍫 CocoaPatterns — iOS & Mac Development Since 2009 RSS
🍫 CocoaPatterns
Because someone has to write this stuff down
"We ship apps. Sometimes they even work."

Restart Your Computer to Fix Bugs: A Rigorous Methodology

The most underrated debugging technique in software engineering has been right in front of us the whole time.

BK
Brad Kowalski
@bradkow_ios · CocoaPatterns

I'm going to say something controversial: the most productive thing you can do when you hit a bug is close your laptop, stand up, and restart your computer. Not after twenty minutes of investigation. Not after adding a breakpoint. Immediately. Before you even read the error message.

I call this Reboot-First Debugging (RFD), and I have a 34% success rate, which I maintain is excellent for any debugging methodology.

"A watched Xcode never builds. But a restarted Mac often surprises you."

The RFD Decision Tree

  1. Have you tried restarting Xcode? → Yes → Have you tried restarting your Mac? → Yes → Have you tried restarting the build server? → Yes → Have you tried restarting the client's Mac? → Yes → Ship it, the bug is theirs now.
📊 Real Data

In a study I conducted on myself over six months, 34% of bugs resolved themselves following a restart. Another 28% were still present but somehow felt less urgent after the reboot. The remaining 38% I filed as "known issues" and moved on with my life.

Common Objections

"But restarting loses my debugging context." Your debugging context is the problem. It's full of bad assumptions and four-hour sunk cost bias. A fresh boot is a fresh mind.

"The bug is a logic error. Restarting won't help." You don't know that. Neither do I. Neither does the computer. Let's all find out together.

"I've been restarting for three days and the bug is still there." You're not restarting correctly. Are you doing a full shutdown, or just a restart? Are you unplugging external monitors? Have you tried restarting your router? What about your chair?

#!/bin/bash
# RFD Automation Script — cron this for maximum effectiveness
echo "Checking for bugs..."
echo "Bugs found. Initiating RFD protocol."
sudo shutdown -r now "fixing bugs"

I've also been experimenting with restarting my test devices, my CI server, my standing desk (unplugging and replugging the motor), and once, memorably, my marriage. Two of those four things are going better since the restart. I'll let you determine which two.

3 Comments — Powered by Disqus
PP
petra_p_dev · 5 days ago
"Restarting your chair" sent me. I have a Herman Miller and I believe in it now.
BK
bradkow_iosAuthor · 5 days ago
@petra_p_dev The Aeron has a surprising number of adjustable components. All of them are load-bearing.
MT
markus_t_eng · 4 days ago
34% is legitimately better than my rubber duck success rate and I don't know how to feel about that.