📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Tell me about the hardest bug you've fixed. What made it hard, how did you narrow it down, what was the root cause, and what did you change so it couldn't come back?

Answering the 'hardest bug' behavioural question: choosing the story, showing a hypothesis-driven method and .NET diagnostic tools, root cause, fix and prevention.

Intermediate Behavioral Intermediate behavioral debugging dotnet problem-solving production-diagnostics star-method

🎯 Key points

  • Pick a bug hard for a reason: intermittent, concurrency, production-only, cross-system
  • Explain clearly why it was hard before the method
  • Hypothesis → evidence → narrow down, not random changes
  • Name tools: dotnet-dump, dotnet-trace, Application Insights / OpenTelemetry, Query Store
  • Root cause at the mechanism level, and the systemic gap that allowed it
  • Collaboration: who you pulled in across teams
  • Fix plus regression test, monitoring and written learnings
  • Result in business terms (customers, money, support load) with a number

⏱ 30-second answer

Pick a bug that was hard for a reason: intermittent, only in production, a race condition, or across systems. Then show your method: how you gathered evidence (Application Insights / OpenTelemetry traces, dotnet-dump, dotnet-trace, Query Store), the hypotheses you tested and ruled out, who you worked with, the root cause and the systemic gap that allowed it, the fix, and the regression test or alert that stops it returning.

Close on the business impact (customers, money, support load). The trade-off is depth versus clarity: enough technical detail to be credible, explained so anyone in the room can follow.

🗣 Full answer (senior)

How I would answer this in an interview

"The hardest one was at [company], on [the order processing service], which handled [N orders a day]. Every few days, [orders were processed twice], but only in production and never when we looked. It was hard because it was intermittent and it didn't reproduce locally.

I stopped guessing and gathered evidence. I [added correlation ids to the logs and queried Application Insights for duplicated order ids], which showed the duplicates always happened [during a scale-out, when two instances picked up the same message]. My hypothesis was [a message lock expiring during a slow database call]. I confirmed it by [comparing the Service Bus lock duration with the p99 of the handler]: [the handler sometimes took longer than the lock]. The root cause was [a non-idempotent handler combined with a lock shorter than the slowest processing time].

I fixed it in two layers: [made the handler idempotent with a unique constraint on the message id] and [renewed the lock / reduced the work inside it]. I added [an integration test that delivers the same message twice] and [an alert on duplicate key violations]. Duplicates went from [about N a week] to [zero over the next X months]. What I took from it is to design every message handler as idempotent from day one."

The mistake I see is telling a bug that was hard only because the code was unfamiliar, or skipping straight to the fix. The method is the answer.


What makes a good "hardest bug" story

Good choice Weak choice
Intermittent or production-only A typo that took a day to spot
Concurrency, memory, performance, distributed "I didn't know the framework yet"
You led the investigation Someone else found it, you watched
Has a measurable result and prevention "It went away after a restart"

Tools worth naming (.NET)

Symptom Tool
High CPU, hang dotnet-trace, dotnet-counters, dotnet-dump analyze
Memory growth dotnet-gcdump, dotnet-dump with dumpheap -stat
Slow query Query Store, actual execution plan
Distributed failures Application Insights end-to-end transaction, OpenTelemetry traces

Production example

A strong result line combines impact and prevention: "[Duplicate charges dropped from ~N a week to zero], and the idempotency pattern became [our team standard for all Service Bus handlers]."

🔍 What the interviewer is checking

Checks the candidate's debugging method, technical depth and ownership of prevention, told clearly.

Green flags

  • Explains why the bug was hard
  • Hypotheses, evidence and named tools
  • Root cause explained at the mechanism level
  • Fix plus test, alert or standard

Red flags

  • Random changes until it went away
  • No root cause or prevention
  • Blames a colleague

📚 Learn in depth

1. What the interviewer is assessing

  • Problem-solving method: hypotheses, evidence, narrowing down.
  • Technical depth: do you understand the mechanism of the root cause?
  • Persistence and calm: did you keep going methodically?
  • Ownership: did you prevent recurrence, not just patch?
  • Communication: can you explain a complex bug simply?

2. The debugging loop to describe

Observe symptom ─► Gather evidence ─► Form hypothesis ─► Test it
       ▲                                                  │
       └───────────── ruled out? refine ◄─────────────────┘
                              │ confirmed
                              ▼
                 Root cause ─► Fix ─► Prevent (test, alert)

Saying out loud which hypotheses you ruled out is a strong signal.

3. Using STAR here

  • S/T: system, scale, symptom, why it was hard, your role. Two sentences.
  • A: evidence, hypotheses, tools, the root cause mechanism, the fix.
  • R: number, prevention, lesson.

SOAR (Situation, Obstacle, Action, Result) fits well because the obstacle is the reason the bug was hard.

4. Pitching for the audience

With an engineer, name the mechanism (lock expiry, thread pool starvation, parameter sniffing). With a manager or HR, explain impact (duplicate charges, customers affected) and the method in plain words. Prepare both versions.

5. Re-using the story

The same story answers "tell me about a time you persevered", "a time you worked under pressure" and "a time you improved a system". Change what you stress.

Try it yourself

  1. List three hard bugs from your career and pick the one with the clearest method.
  2. Write the root cause in one sentence a non-engineer understands.
  3. List the hypotheses you ruled out.
  4. Write the result with a number (use [placeholders] until you check).
  5. Practise a technical (2 min) and non-technical (60 s) version.

💻 Code

Fill-in template:

S   At [company], [system] did [symptom] [how often], affecting [users / money].
T   It was hard because [intermittent / prod-only / concurrency]. I [owned / led] the investigation.
A   I gathered evidence with [tool], which showed [pattern].
    I suspected [hypothesis A], ruled it out because [evidence].
    I confirmed [hypothesis B] by [test / measurement].
    Root cause: [one plain sentence].
    Fix: [immediate] and [long-term].
R   [Metric X → Y]. I added [test / alert / standard]. Lesson: [one line].

Illustrative only:

Orders were [occasionally charged twice]; only under [scale-out].
Application Insights showed [two instances handling one message].
Root cause: [lock expired during a slow DB call; handler not idempotent].
Fix: [unique constraint on message id]; duplicates went to [zero].

⚠ Common mistakes

  • Mistake: Choosing a bug whose only difficulty was that you were new to the code. Why it is wrong: on its own it doesn't show much method. Instead: if you use it, stress how you got up to speed and the structured approach you took; better, pick one hard for a technical reason.
  • Mistake: Jumping to the fix. Why it is wrong: the method is what's being scored. Instead: walk through evidence and hypotheses.
  • Mistake: "We" found it. Why it is wrong: your role is unclear. Instead: say what you did and credit others' parts.
  • Mistake: No prevention. Why it is wrong: it looks like a patch, not ownership. Instead: name the test, alert, standard or write-up you added.
  • Mistake: Only technical results. Why it is wrong: senior engineers are expected to connect work to business outcomes. Instead: add customers affected, refunds avoided or support tickets saved.
  • Mistake: Drowning a non-technical interviewer in jargon. Why it is wrong: they can't score it. Instead: explain impact and method in plain words.
  • Mistake: Blaming the person who wrote the code. Why it is wrong: it signals poor collaboration. Instead: describe the system gap that allowed it.
  • Mistake: Rambling for five minutes. Why it is wrong: it hides the structure. Instead: keep to about two minutes and let them dig.

🏛 Senior insight: trade-offs

A senior answer shows a repeatable method and systemic prevention: the bug led to a pattern, test or standard that protected the whole team. Mentioning the hypotheses you ruled out, and the trade-off in the fix (quick mitigation now, structural fix later), is what lifts it above a mid-level answer.

Story type When it fits Cost When not to
Concurrency / distributed bug Backend senior roles Needs clear explanation Non-technical panel without simplifying
Performance regression Roles stressing scale Needs numbers If you can't remember the figures
Data corruption bug Finance, healthcare, government Sensitive; keep details generic If under NDA, generalise more

Measure your story by asking a peer to repeat the root cause after one hearing.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate's bug story involved a live production incident. Why: Checks how they handle the incident end to end, from alert to postmortem.
    How to answer

    Pick a real incident where you played a clear role, and tell it in STAR order in about two minutes. Situation: the system, scale and impact in numbers (users, minutes, error rate). Task: your role — responder, incident commander, or the person who found the cause. Action: how it was detected, how you triaged and set severity, how you mitigated first (rollback, flag, failover), how you investigated with named tools (Application Insights and KQL, distributed traces, dotnet-counters, Query Store), and how you communicated. Result: time to mitigate, what the contributing factors were and which system changes came out of the postmortem, with a number that shows it worked.

    The trade-off interviewers listen for: you restored service before chasing the root cause, and you fixed the system rather than blaming a person.

  2. When: Candidate describes their debugging method. Why: Checks the method is transferable, not luck.
    How to answer

    Start with impact and timeline: who is affected, since when, what changed (deploys, config, traffic, dependencies). Check telemetry before code: Application Insights and Azure Monitor metrics, Log Analytics (KQL) queries over logs, failure and dependency maps, remembering sampling may hide rare events. Form one testable hypothesis at a time from that evidence and any past incidents. Mitigate first if users are hurting (roll back, scale out, feature flag), then capture evidence with dotnet-counters, dotnet-trace or dotnet-dump to find the root cause.

  3. When: Candidate uses a lot of technical terms while a non-technical panel member is present. Why: Checks the candidate can adapt a technical story to the audience.
    How to answer

    Tell it as a story with a clear arc: lead with impact (customers affected, money, risk), explain the cause with one plain analogy that fits your actual bug (for a race condition: "two staff members both picked up the same order and each shipped it"), describe your method without tool names ("I collected evidence and tested my theories one by one, with help from [the team]"), and finish with a business result and what you changed so it can't recur. Watch their reactions and offer technical depth rather than forcing it.

🛠 Real-world problems: how you handle them

Intermittent duplicate processing only in production
Situation
[Order service] on [Azure Service Bus], [N messages a day]; duplicates every [few days] costing [refunds / support time].
Signals
[Customer complaints of double charges], duplicate rows in [orders table], no errors in logs, not reproducible locally.
Investigation
Correlation ids in Application Insights; grouping duplicates by instance and time; comparing handler p99 duration with the message lock duration; reviewing the handler for idempotency; STAR notes written afterwards for the story.
Resolution
Immediate: [lock renewal / longer lock]. Real fix: idempotent handler with a unique constraint on message id and a check before side effects.
Prevention
Integration test delivering the same message twice; alert on duplicate key violations; team standard that every handler is idempotent.

How to tell it (STAR)

**S:** At [company], our [order service] occasionally [charged customers twice], only in production. **T:** I took ownership of finding the cause. **A:** I added correlation ids, queried Application Insights and found duplicates always happened [during scale-out]. I tested the hypothesis that [the Service Bus lock expired during slow DB calls] and confirmed it by comparing [handler p99] with [lock duration]. I made the handler idempotent with [a unique constraint on message id] and added a test that delivers the same message twice. **R:** Duplicates went from [N a week] to [zero over X months], and idempotent handlers became [our team standard].

↩ Usually asked after

More in Behavioral Interview Topics

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me