Level: AdvancedInterview

Go Production Debugging Scenarios: Incident Cases

Updated 11 min read
Go Production Debugging Scenarios featured image: goroutine dump, request ID and rollback cards

These Go production debugging scenarios describe real incidents, such as crashes, hangs, wrong data, leaks and slow requests, and ask how you would find the cause. Each one follows the steps an on-call engineer takes at 2 AM. We gathered them from public interview lists and incident write-ups, then rewrote each one in our own words.

This post is questions only, so answer each one in your own words first. When you need help, read Go structured logging with slog, Go profiling with pprof and Go health checks. Also, finish our post on performance scenarios first, because many incidents start as slowness.

How to Use These Go Production Debugging Scenarios

For each of these Go production debugging scenarios, answer three questions. First, how do you stop the damage? Then, how do you find the cause, and how do you stop it from coming back? That order matters in real incidents. Finally, name the exact tool or command you would use.

The table below lists each section and its number of questions.

SectionWhat it testsQuestions
Crashes and panicsNil maps, nil pointers and stacks15
HangsStuck goroutines, locks and timeouts15
Bad responsesWrong data, 500s and timeouts15
LeaksMemory, file handles and goroutines15
ObservabilityLogs, metrics and traces15
Incident responseTriage, rollback and follow-up15
Go Production Debugging Scenarios diagram showing six kinds of production problems to debug
The six kinds of production problems covered in this question list.

Go Production Debugging Scenarios on Crashes and Panics

Before you answer, study Go panic and recover with defer. These Go production debugging scenarios start with the loudest failures.

  1. Your service restarts every few minutes with invalid memory address, so how would you find the line?
  2. A panic stack trace shows assignment to entry in nil map, so what was not initialised?
  3. When a panic happens in a background goroutine, why does the whole process die?
  4. A crash only happens for one customer, so how would you reproduce it safely?
  5. Imagine a panic message with index out of range [5] with length 5, then what kind of bug is it?
  6. Your HTTP server survives handler panics but a worker crashes the pod, so what is different?
  7. After a deploy, the service crashes on startup in production only, so what would you compare?
  8. A fatal error says concurrent map writes, so why can recover not catch it?
  9. When a crash leaves no logs, how would you capture the stack next time?
  10. Your service crashes with out of memory but no panic message, so where would you look?
  11. A third-party library panics on bad input, so how would you protect your service?
  12. When crash loops fill the logs, how would you find the first real error?
  13. A panic happens only on ARM nodes, so what would you suspect?
  14. Scenario: when a crash affects 1 percent of requests, would you roll back or hotfix?
  15. Scenario: when a panic hides behind a recover that only logs a short message, how would you get more detail?

Go Production Debugging Scenarios on Hangs

Before you answer, study our post on goroutines. A hung service gives few clues, so these Go production debugging scenarios focus on gathering evidence.

  1. A service stops answering but the process is alive and CPU is near zero, so what would you capture first?
  2. Your goroutine dump shows thousands of goroutines in chan send, so what does that tell you?
  3. When most goroutines wait on sync.Mutex.Lock, how would you find the holder?
  4. A health check passes but real requests time out, so what is the health check missing?
  5. Imagine every request hangs on a call to one partner API, then what setting is missing?
  6. Your service hangs only after the database fails over, so what would you check in the pool?
  7. After a config change, the service hangs on startup, so how would you find where?
  8. A cron job never finishes and the next run overlaps, so how would you detect and stop it?
  9. When SIGQUIT is not possible in your platform, how else can you get stacks?
  10. Your queue consumer stops processing but shows no errors, so what would you look at?
  11. A deadlock happens once a week, so how would you collect proof the next time?
  12. When the readiness probe flips during a hang, how does that help or hurt?
  13. A slow DNS server makes calls hang, so how would you prove it?
  14. Scenario: when restarting the pod fixes a hang for a day, how would you find the root cause?
  15. Scenario: when a hang only happens under peak traffic, how would you reproduce it in staging?

Go Production Debugging Scenarios on Bad Responses

Before you answer, study Go error wrapping. Wrong answers can be worse than crashes, so these Go production debugging scenarios test careful tracing.

  1. Error rates jump to 10 percent after a deploy, so what are your first steps?
  2. Users see another user’s name on their profile, so what kinds of bugs would you look for?
  3. When an API returns 200 with an empty list instead of data, how would you trace it?
  4. A spike of 502 errors comes from the load balancer, so how would you tell if your service is at fault?
  5. Imagine prices show with the wrong currency for one region, then where would you start?
  6. Your logs say context canceled for many requests, so what does that usually mean?
  7. After a dependency upgrade, JSON fields come back with different names, so what changed?
  8. A timezone bug shows orders on the wrong day, so how would you find it?
  9. When errors only happen on one of ten pods, what would you compare?
  10. A feature flag turns on a new path and errors rise, so what would you do first?
  11. Your service retries a failing call and makes the outage worse, so how would you stop it?
  12. When a rare error has no request ID in its log line, how would you connect it to a user?
  13. A webhook from a partner fails signature checks after their change, so how would you confirm it?
  14. Scenario: when customer support reports a bug you cannot see in any dashboard, how would you investigate?
  15. Scenario: when a data bug has run for a week, how would you find every affected record?

Go Production Debugging Scenarios on Leaks

Before you answer, study Go garbage collector and memory. Leaks build up slowly, so these Go production debugging scenarios test patience and method.

  1. Memory grows by 200 MB a day until the pod restarts, so how would you find the leak?
  2. Your service hits too many open files, so which resources would you check?
  3. When the goroutine count rises with each request and never falls, what would you look for?
  4. A heap profile shows a big map in a cache package, so how would you confirm it is the leak?
  5. Imagine a ticker that is never stopped in a per-request helper, then what leaks?
  6. Your HTTP client leaks connections, so which line is usually missing?
  7. After a library upgrade, memory doubles, so how would you compare versions?
  8. A leak only appears with one rare request type, so how would you find it?
  9. When two heap profiles taken an hour apart differ, how would you compare them?
  10. Your database connections leak during errors only, so where would you look?
  11. A temp file folder fills the disk, so what code would you check?
  12. When a leak is too slow to see in staging, how would you speed up the test?
  13. A team adds a nightly restart to hide a leak, so how would you argue for a real fix?
  14. Scenario: when memory grows but no single allocation site stands out, what would you check next?
  15. Scenario: when a leak fix needs a risky refactor, how would you contain the problem until then?

Logs, Metrics and Traces

Before you answer, study Go structured logging with slog. Good signals make every other section easier, so these questions check what you would add before the next incident.

  1. Your logs are plain text and hard to search, so how would you move to structured logs?
  2. When you cannot join logs from ten services for one request, what would you add?
  3. A dashboard shows only averages, so which metrics would you add for latency?
  4. Your alerts fire on every small blip, so how would you make them useful?
  5. Imagine a slow request that crosses five services, then how would a trace help?
  6. Logs are too costly to keep at debug level, so how would you sample them?
  7. After adding tracing, CPU rises a little, so how would you decide if it is worth it?
  8. A metric has a label with user IDs and the metrics server struggles, so what went wrong?
  9. When a log line includes a password, how would you fix and clean it up?
  10. Your service needs an SLO dashboard, so which three graphs would it show?
  11. A trace has gaps between spans, so what does that usually mean?
  12. When the same error appears at three levels of the stack, how would you clean it up?
  13. A team wants to log full request bodies, so what are the risks?
  14. Scenario: when an incident review says we had no data, what would you add first?
  15. Scenario: when on-call engineers cannot find the right dashboard, how would you organise them?

Go Production Debugging Scenarios on Incident Response

Before you answer, think about calm steps under pressure. These Go production debugging scenarios finish with the people side of incidents.

  1. A page wakes you at 2 AM for a 50 percent error rate, so what do you do in the first five minutes?
  2. Your last deploy was an hour ago, so would you roll back before you know the cause?
  3. When two teams both think the other caused an outage, how would you move forward?
  4. A fix is ready but untested, so how would you decide to ship it during an incident?
  5. Imagine status page updates are late and customers are angry, then who owns the message?
  6. Your incident has three people changing things at once, so how would you coordinate?
  7. After the incident, what goes into a blameless review?
  8. A similar incident happened last month, so which follow-up did the team miss?
  9. When a rollback is impossible because of a schema change, what are your options?
  10. Your runbook is out of date during an incident, so what would you do after?
  11. A junior engineer caused the outage, so how would you handle the review?
  12. When a partner outage takes you down, what would you change in your design?
  13. How do you decide the severity level of an incident?
  14. Scenario: when an incident lasts six hours, how would you hand over between on-call engineers?
  15. Scenario: when leadership asks how to avoid all incidents, what would you tell them?

Code Reading Questions

Read each program carefully and predict the output before you run it. Then explain the result in your own words.

package main

import (
    "fmt"
    "net/http"
    "net/http/httptest"
)

func recoverMW(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        defer func() {
            if v := recover(); v != nil {
                fmt.Println("recovered:", v)
                http.Error(w, "internal error", http.StatusInternalServerError)
            }
        }()
        next.ServeHTTP(w, r)
    })
}

func main() {
    var cache map[string]int
    h := recoverMW(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        cache[r.URL.Path]++
        fmt.Fprintln(w, "ok")
    }))
    rec := httptest.NewRecorder()
    h.ServeHTTP(rec, httptest.NewRequest("GET", "/home", nil))
    fmt.Println(rec.Code, rec.Body.String())
}
  1. What message does the middleware print, and what status does the client get?
  2. Which extra detail would you log here so the on-call engineer can find the bug fast?

The second program writes structured logs with a request ID.

package main

import (
    "bytes"
    "fmt"
    "log/slog"
)

func main() {
    var buf bytes.Buffer
    h := slog.NewJSONHandler(&buf, &slog.HandlerOptions{
        Level: slog.LevelInfo,
        ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
            if a.Key == slog.TimeKey {
                return slog.Attr{}
            }
            return a
        },
    })
    log := slog.New(h).With("request_id", "r-77")
    log.Debug("cache miss", "key", "user:42")
    log.Info("order saved", "order_id", 9001, "ms", 42)
    log.Error("payment failed", "err", "card declined")
    fmt.Print(buf.String())
}
  1. How many lines print, and why is the cache miss line missing?
  2. Why does every line carry request_id, and how does that help during an incident?

Quick Revision Table for Debugging Tools

Use the table below as a final check before your interview. It maps each symptom to the first tool to reach for.

SymptomFirst toolWhat it shows
Crash loopPanic stack in logsThe exact line and goroutine
Hang, low CPUGoroutine dumpWhere every goroutine waits
Slow requestsTracesTime spent in each service
Rising memoryHeap profiles over timeWhat keeps growing
Too many open filesOpen file count, code reviewMissing Close calls
Error spikeError logs by request IDFirst failing request

Also, many interviewers ask when to use logs and when to use traces. The diagram below shows the difference side by side.

Go production debugging diagram comparing logs with traces
Logs record the detail of single events, while traces follow one request across every service it touches.

Official Resources

These official pages explain the tools behind these scenarios.

Quick Recap

  • These Go production debugging scenarios cover crashes, hangs, bad responses, leaks, signals and incident response.
  • Stop the damage first, often with a rollback, then find the cause.
  • A goroutine dump is the best first step for a hung service.
  • Heap profiles over time reveal slow leaks.
  • Structured logs with request IDs and traces make incidents shorter.
  • Every incident ends with a blameless review and a real follow-up.

What’s Next?

By now, you have Go production debugging scenarios for the incidents real teams face. Practise your answers out loud, then check your progress in the Go interview topics study guide.

Next up: Go microservices scenario questions