I'd been staring at the same bug for the better part of three hours and getting nowhere, the kind of nowhere where you've read the same forty lines so many times they've stopped meaning anything. An intermittent failure, the worst sort, present maybe one run in five, gone the moment I added a log line to catch it. A textbook Heisenbug. I knew it was a race somewhere, I just couldn't see where, and the harder I looked the less I saw.
So I stopped. I put the laptop down, pulled on too many layers because it was the end of December, and took the bike out for an hour up the lane. It was cold enough that the puddles had a skin of ice and my fingers complained for the first ten minutes. None of that is the point. The point is what happened to the bug.
About twenty minutes in, freewheeling down the hill with my mind comfortably elsewhere, the answer simply arrived. Not as a flash of genius, nothing so flattering. It just surfaced, quietly, the way a name you've been hunting for turns up an hour after you stopped trying to remember it. Two goroutines touching the same map, one of them outside the lock, on a path I'd convinced myself was single-threaded and wasn't. Obvious in hindsight. Invisible at the keyboard, because at the keyboard I was too busy looking to actually think.
There's something well understood going on here and it isn't mystical. Concentration is a narrow beam. When you stare at a problem you keep dragging your attention back to the same handful of suspects, and your tired brain just runs the same dead-end loop faster and faster. Step away, give it a rhythmic, undemanding task like turning the pedals, and the back of your mind gets to roam over the bits you'd been ignoring. The diffuse mode, some call it. I call it going for a ride.
I'm not pretending the bike fixes every bug, or that the answer to a hard problem is always "stop working on it". Plenty of bugs need exactly the grind of careful reading and a debugger. But there's a particular flavour of stuck, the kind where you can feel yourself going in circles, where the most productive thing you can do is the thing that feels least productive: shut the lid and leave the room. The work carries on without you. Sometimes it does it better.
I came back with cold hands, made a coffee, added the missing lock, and the failure was gone in ten minutes. Three hours at the desk, twenty minutes on the bike. I'd like to claim I planned it that way.