You're handed a bug that reproduces reliably in production, but it vanishes the moment you attach a debugger or add log statements. How do you reason about what's happening and how do you actually catch it?

technical-conceptual · Mid level · software-engineering

What the interviewer is really asking

Assesses understanding that observation can change timing-sensitive behavior (a heisenbug), and whether the engineer can choose investigation techniques that don't perturb the system. Probes reasoning about concurrency and tooling, not memorized definitions.

What to say

What to avoid

Example answers

Strong: That pattern says the act of observing is changing the timing, so it's likely a race or timing-dependent bug. I'd stop using breakpoints and switch to a lock-free async log or a record-replay debugger that captures the run without serializing threads. Then I'd try to make it worse, not better, by running a thread sanitizer and injecting small delays around the suspect shared state to amplify the bad interleaving, and fix the synchronization once I can see it.

Weak: If it goes away under the debugger it's probably a fluke or a build issue, so I'd just add a small delay or extra logging where it crashes since that seems to stabilize it, and keep an eye on whether it comes back.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.