Diagnosing an 80% Stuck-Spinner Outage on a Google Cloud Web App

Medium · Software Engineering Fundamentals · Software Engineer · Technical Screen

Prompt

You are on call for a customer-facing web application hosted on Google Cloud. Roughly 20% of visitors experience normal page loads, while the remaining ~80% stay stuck indefinitely on an initial loading spinner with the main interface never rendering.

Walk through a disciplined, end-to-end investigation to isolate where the breakdown happens and verify its root cause. Avoid jumping prematurely to a single pet theory (such as assuming a recent release or configuration toggle caused the issue).

Keep the following context in mind as you structure your walkthrough:

  • The exact architecture behind the browser—frontend framework, CDN caching, load balancers, Google Cloud compute runtime (such as Cloud Run, GKE, App Engine, or Compute Engine), backend microservices, data stores, and existing telemetry—is intentionally left open. Ask clarifying questions or state clear engineering assumptions as needed.
  • You do not know up front whether the incident started abruptly at a specific timestamp (for example, alongside a deployment). Treat onset timing, whether the 80/20 failure behavior is sticky to specific users or random across reloads, and whether impacted sessions share client, account, or geographic traits as facts to establish during triage.

Scope & Expectations

  • Initial scoping & triage: Frame targeted questions and quick experiments that characterize the 80/20 split, establish onset timing, and narrow down client versus server boundaries before diving into one component.
  • End-to-end evidence collection: Deduce what already succeeded for a spinner to render, trace the remaining browser startup stages, and correlate client diagnostics with Google Cloud edge, load-balancer, and backend telemetry.
  • Hypothesis testing & safe remediation: Enumerate architectural layers capable of partitioning traffic or users 80/20, test hypotheses one at a time using falsifiable predictions, and restore full service safely without overwhelming healthy capacity.

Step-by-step walkthrough

  1. Scope the outage first to cut the search space in half

    Before opening logs or guessing about recent deployments, ask clarifying questions that eliminate half of the architecture at a time, and state explicit assumptions wherever details are unspecified.

    For concreteness, assume a typical web architecture on Google Cloud: a single-page application (SPA)—a web app where the browser loads a minimal HTML shell once and JavaScript fetches JSON data to render the page—fronted by an external Google Cloud Application Load Balancer with Cloud CDN (edge caches that serve static files close to users), backed by API instances on Cloud Run or Google Kubernetes Engine (GKE).

    Four scoping checks immediately narrow down what kind of failure we are hunting:

    • Per-user split or per-page-load split? Ask an affected person to reload 5 times in their normal browser and once in a private/incognito window:
    Reload 5x + try incognito on an affected machine
     ├── Works ~1 in 5 reloads (random per page load)
     │     └── Routing / backend split: load-balanced instances, Cloud Run traffic split, rolling deploy
     └── Fails 5 of 5 reloads (sticky to this user)
           ├── Incognito WORKS  ──► Local browser state: stale service worker, cached JS, corrupt cookie, extension
           └── Incognito FAILS  ──► Server/network rule: 80% feature flag, account data, region/ISP, browser version
    
    • When did it start, and was it a sudden step or a slow climb? Compare error-rate and page-render graphs over the past 24 hours against the audit trail (deployments, Cloud Run traffic changes, feature-flag toggles, DNS/TLS updates). Correlation in time is a strong lead to test, not proof.
    • What do failing sessions have in common? Slice metrics by browser family/version, OS, geographic region, logged-in state, and account tier. If Safari fails at 100% and Chrome fails at 0%, backend database theories vanish immediately.
    • Triage severity vs root-cause analysis: 80% of users stuck on a spinner is a major incident. If the failure started at the exact minute of a release or flag flip, rolling it back is a sensible mitigation—provided you still verify whether recovery happens rather than assuming the rollback solved it.
  2. Deconstruct the browser startup sequence behind the spinner

    Seeing an animated spinner on screen already eliminates several failure modes: DNS resolution, TCP/TLS negotiation, fetching index.html, and painting the initial shell all completed. To stay stuck forever, execution must stall somewhere between mounting that shell and rendering the first interactive view:

    Browser Boot Sequence
      [1. GET /index.html] ─────────► OK (spinner markup & CSS arrived on screen)
      [2. GET /static/main.hash.js] ► 404 from version skew? Corrupted CDN cache? Blocked by CSP?
      [3. GET /config.json / flags] ► Hanging? Invalid JSON?
      [4. Auth / token refresh] ────► Infinite redirect loop? Third-party cookie blocked?
      [5. Initial JSON API calls] ──► Pending forever? 502/504 timeout? CORS rejection?
      [6. Framework mount & render] ► Uncaught TypeError on unexpected API field leaves spinner up?
    

    Any of steps 2–6 can stall the spinner in four distinct ways, and browser DevTools immediately shows which one happened:

    1. Request hangs pending: The Network tab shows a request stuck in (pending) until a proxy or load balancer times out.
    2. Request fails and code swallows the error: A 4xx, 5xx, or CORS (Cross-Origin Resource Sharing) error—where the browser blocks JavaScript from reading a response from another domain missing Access-Control-Allow-Origin headers—appears in Network/Console, while an empty catch block forgets to hide the spinner.
    3. Uncaught JavaScript crash: Console logs a ChunkLoadError (missing lazy-loaded bundle) or TypeError before the UI replaces the spinner.
    4. Browser-side block: An extension, ad blocker, or CSP (Content Security Policy) rule—an HTTP header telling the browser which script/API domains are allowed—blocks a critical script or API call before it ever reaches Google Cloud.

    Capturing one failing browser session's Network and Console output—ideally saved as a HAR (HTTP Archive) file, a JSON recording of every browser request, header, status, and timing—pinpoints the exact stalled step in under a minute.

  3. Enumerate every client and cloud mechanism behind an 80/20 traffic split

    Consistent 80/20 ratios point to an explicit routing weight, cohort rule, cached state, or multi-call failure amplification. Map out each candidate layer alongside the evidence that confirms or eliminates it:

    Layer / Mechanism                           Split Behavior         Confirming Signature
    ----------------------------------------------------------------------------------------------------------
    Load balancer -> unhealthy backend pool     Per request            Failing requests map to specific instances
    Cloud Run revision traffic split (80 / 20)  Per request*           80% of requests log the broken revision
    Rolling deploy / bundle version skew        Per request (window)   New index.html gets 404s on JS chunks
    Cloud CDN poisoned edge cache               Per region / URL key   httpRequest.cacheHit=true in affected POPs
    Feature flag / A-B experiment at 80%        Per user (stable)      Failures match user IDs hashed into flag
    Service worker or stale browser cache       Per browser (stable)   Returning visitors spin; incognito works
    Auth cookie / session state                 Per user (stable)      Logged-in users fail; fresh login works
    Cloud Armor WAF / IPv6 / regional routing   Per network            Failures cluster by country, ASN, or IPv6
    Browser engine or extension incompatibility Per client             Failures cluster on specific browser build
    * Becomes sticky per browser if session affinity (routing repeat requests via an affinity cookie) is enabled.
    

    Notice why service workers—background browser scripts that cache files locally and intercept network fetches across page reloads—are worth checking early: if an old service worker serves a stale index.html referencing JavaScript chunk filenames that a new deployment deleted from storage, returning visitors (say, 80% of traffic) spin forever on 404 chunk errors while first-time or incognito visitors (20%) load cleanly.

  4. Check the math: 20% broken backends can break 80% of page loads

    Never assume "80% of page loads fail" means "80% of servers are broken." When a page must complete multiple independent API calls before removing its spinner, a small per-request failure rate compounds rapidly.

    Suppose only 1 out of 5 backend instances is broken (so any single API call fails with probability p = 0.20 and succeeds with probability 1 - p = 0.80), and the load balancer routes each HTTP request independently. If the home screen runs k = 7 parallel API calls via Promise.all(...) before hiding the spinner, all 7 calls must dodge the broken instance:

    P(1 API call succeeds)        = 1 - 0.20 = 0.80  (80%)
    P(all 7 API calls succeed)    = 0.80^7   = 0.210 (21.0% of page loads succeed)
    P(at least 1 call fails -> spin) = 1 - 0.210 = 0.790 (79.0% of page loads spin!)
    

    We can compare both scenarios in a few lines of Python:

    def page_success_rate(bad_instance_fraction: float, required_calls: int) -> float:
        """Probability that every independent API call on a page hits a healthy instance."""
        single_call_success = 1.0 - bad_instance_fraction
        return single_call_success ** required_calls
    
    
    # 1 broken instance out of 5 (20% bad) across 7 required API calls -> ~21.0% pages load
    print(round(page_success_rate(0.20, 7), 3))  # 0.21
    
    # 4 broken instances out of 5 (80% bad) across 1 required API call -> 20.0% pages load
    print(round(page_success_rate(0.80, 1), 3))  # 0.2
    

    Both produce an ~80% user-visible spinner rate, yet they look completely different in load-balancer logs: in the first case only 20% of individual backend requests fail, whereas in the second case 80% fail.

  5. Collect and correlate client and Google Cloud telemetry

    Gather evidence from both ends of a failing session and join them on a shared request or trace ID:

    • Browser side: Inspect a failing HAR file and Console log to find the exact URL, HTTP status, timing, and response headers (Age or X-Cache indicates Cloud CDN served a cached object; X-Cloud-Trace-Context or X-Request-ID identifies the server log entry). Check Real-User Monitoring (RUM)—client-side telemetry collected from real visitors' browsers—for JavaScript error spikes and "time-to-rendered" drop-offs sliced by browser, release version, and country.
    • Google Cloud side: Query Cloud Logging and slice metrics by backend instance, Cloud Run revision, zone, and URL path rather than looking at fleet-wide averages:
    # External Application Load Balancer logs: inspect status, latency, cacheHit, and statusDetails
    resource.type="http_load_balancer" AND httpRequest.status>=400
    
    # Distinguish backend timeouts from explicit 5xx responses using jsonPayload.statusDetails:
    resource.type="http_load_balancer" AND jsonPayload.statusDetails="backend_timeout"
    
    # Cloud Run logs: group errors or slow requests by revision_name and instanceId
    resource.type="cloud_run_revision" AND severity>=ERROR
    

    Pay special attention to jsonPayload.statusDetails on the Google Cloud load balancer: backend_timeout (often hitting the default 30-second backend service timeout) proves requests reached an unresponsive backend instance, whereas response_sent_by_backend means the application code actively returned an error, and zero load-balancer entries at all means the request failed in the browser, DNS, or CDN edge before reaching your project.

  6. Test one hypothesis at a time with falsifiable predictions

    Never change three settings at once. State a concrete hypothesis, predict what a targeted check must show if that hypothesis is true (and what would disprove it), and verify before acting:

    Step  Observation                                    Falsifiable Prediction & Next Check
    --------------------------------------------------------------------------------------------------------
    1     Same user spins on 4 of 5 reloads in incognito Rules out cookies/service worker; check Network tab
    2     GET /api/bootstrap hangs 30s -> HTTP 502       Check LB logs for /api/bootstrap by backend target
    3     LB shows statusDetails="backend_timeout" only  Compare Cloud Run revisions or GKE pods b-e vs a
          on instances b, c, d, e; instance a is 12ms
    4     Instances b-e run revision-042 (80% traffic    Prediction: hitting revision-042 directly via a
          split) whose new DB host firewall drops TCP    dedicated revision tag URL hangs; revision-041 works
    5     Direct curl to revision-042 tag hangs; 041 OK  Root cause confirmed before touching user traffic!
    

    To test a single backend directly without guessing through the load balancer: - On GKE, run kubectl port-forward pod/<suspect-pod> 8080:8080 and send the failing request directly to that pod. - On Compute Engine, curl the suspect VM's internal VPC IP from a bastion host. - On Cloud Run, attach a revision tag (gcloud run services update-traffic SERVICE --set-tags=debug=REVISION) to get a private URL for that exact revision without changing live user traffic percentages.

  7. Mitigate safely, verify user recovery, and close systemic gaps

    Once confirmed, restore service reversibly and then fix the holes that let an 80% failure reach users:

    1. Check capacity before shifting traffic: If healthy instances currently handle only 20% of traffic, shifting the remaining 80% onto them multiplies their load by 5x. Pre-scale min-instances / replicas on the healthy version first so the mitigation does not trigger a cascading overload outage.
    2. Execute one reversible mitigation: Shift 100% of Cloud Run traffic back to the healthy revision, roll back the instance template, or invalidate a poisoned CDN path (gcloud compute url-maps invalidate-cdn-cache URL_MAP --path "/index.html"—avoid --path "/*" unless necessary, because wiping every cached asset at once floods origin servers). Allow connection draining—giving removed instances a brief grace window to finish in-flight requests before termination.
    3. Verify with user-facing metrics: Confirm recovery not just from server 5xx graphs, but from the client-side percentage of page views reaching "content rendered."
    4. Fix the systemic gaps:
      • Frontend resilience: Add explicit request timeouts (AbortSignal.timeout), React/UI error boundaries, and a retry screen so failures show an actionable message instead of an eternal spinner.
      • Instance-local readiness checks: Make /readyz verify the instance's own initialization (such as establishing its DB pool or loading config) without failing every healthy instance simultaneously during a brief shared-DB blip.
      • Progressive delivery: Roll out backend and config changes via a canary deployment (sending 1–5% of traffic first with automated rollback on elevated error or latency rates) rather than jumping straight to 80% or 100%.

Intuition & how it works

Imagine 4 out of 5 drivers pulling into a multi-lane drive-thru receive a numbered receipt at the speaker, pull forward to the pickup window, and then wait forever without getting their meal. Two clues are sitting in plain sight before you inspect a single kitchen appliance. First, because every driver got a receipt, the entrance road, menu board, and register worked—the breakdown is strictly between "order placed" and "bag handed over." Second, you immediately test whether the same drivers get stuck every day (a problem tied to their loyalty account) or whether any driver gets stuck roughly 4 visits out of 5 (a problem tied to which kitchen lane handles the order).

Why does jumping straight to "let's roll back the last deploy" or staring at average server CPU fail? Guessing a single cause wastes precious incident minutes when the true culprit is an 80% feature-flag rollout, an expired credential on new autoscaled instances, or a stale browser cache—and fleet-wide averages hide single broken servers, hung timeouts that emit zero 500 errors, and browser-side JavaScript crashes that never reach Google Cloud at all.

Walk through a concrete 5-reload test to see how systematic binary search finds the bug fast: 1. Ask an affected teammate to reload the page 5 times in an incognito window: reloads 1, 2, 4, and 5 spin forever, while reload 3 renders normally in 300 ms. That immediately rules out browser extensions, stale cookies, and user-cohort flags—something is failing per request. 2. Open browser DevTools on reload 5: index.html and main.js return 200 OK, proving Cloud CDN and static hosting are healthy, while GET /api/session hangs (pending) for 30 seconds before failing with 502 Bad Gateway (and the frontend catch block forgets to hide the spinner). 3. Look up that failing request's X-Cloud-Trace-Context header in Google Cloud Load Balancer logs: jsonPayload.statusDetails reads "backend_timeout", and slicing all /api/session timeouts by Cloud Run revision shows 100% of timeouts hit rev-019 (receiving an 80% traffic split) while rev-018 (20% split) succeeds in 15 ms—confirming the exact broken unit in three hops.

Key points

  • Scope before diving into logs: Testing whether the 80% failure is sticky per user or random per reload, checking incognito mode, and slicing by browser, region, and start time eliminates most hypotheses in minutes.
  • Treat the spinner as a partial success: DNS, TLS, index.html, and spinner rendering already succeeded; capture one failing browser DevTools Network/Console trace or HAR (HTTP Archive) recording to see which boot step (JS chunks -> config -> auth -> API -> render) stalled.
  • Know every layer that partitions 80/20: Cloud Run revision splits, unhealthy backend subsets, CDN edge caches, 80% feature flags, stale service workers (browser background caching scripts), and regional/browser differences each leave a distinct per-request or per-user signature.
  • Remember compounding call math: A page making k independent API calls with per-call failure rate p only loads with probability (1 - p)^k—so just 1 broken backend out of 5 (p = 0.20) across k = 7 startup calls causes 1 - 0.80^7 = 79% of page loads to spin.
  • Correlate client and server evidence on one request ID: Join one browser HAR entry with its matching Google Cloud Load Balancer (http_load_balancer) and backend (cloud_run_revision or GKE) log entries rather than relying on fleet-wide averages.
  • Confirm with falsifiable predictions and safe capacity math: Probe a suspect backend/revision directly, pre-scale the healthy 20% pool before shifting 5x traffic onto it, and verify recovery using the user-facing "page rendered" rate.

Common mistakes

  • Tunnel-visioning on the most recent code deploy: A deploy is one hypothesis to test, not an automatic diagnosis; config pushes, secret rotations, autoscaling into a misconfigured subnet, or 80% experiment flags break apps with zero code deploys.
  • Checking only backend HTTP 5xx dashboards: Hung connections waiting on timeouts, 200 OK responses with unexpected JSON shapes, 404 missing JavaScript bundles, and CORS or CSP browser blocks can break 80% of users while backend 500 counters stay at zero.
  • Looking at fleet-wide averages instead of per-instance / per-revision slices: One broken pod out of five or one misconfigured region blends into a mild-looking fleet average unless you group logs by revision_name, backend target, and zone.
  • Changing multiple knobs at once during mitigation: Flipping a flag, purging the entire CDN cache, and restarting backends simultaneously makes it impossible to know what actually fixed (or worsened) the incident.
  • Shifting 100% of traffic onto a 20% pool without scaling first: Sending 5x load instantaneously to the surviving healthy instances can overload them and turn an 80% outage into a 100% outage.
  • Handling HAR files insecurely: Browser HAR exports contain live session cookies, Authorization bearer tokens, and personal data—always collect them over restricted internal channels and scrub credentials.

Follow-up questions

  • If the issue never reproduces on your local workstation, how would you capture actionable diagnostic data from impacted sessions? Ask an affected user (or customer support on a screen-share) to export a sanitized HAR file and Console screenshot through a secure channel, noting their timestamp, browser version, and approximate location. In parallel, ship lightweight client telemetry that requires zero user effort: global window.onerror and unhandledrejection listeners plus a 15-second boot-watchdog timer that fires a beacon reporting the furthest boot stage reached (bundles_loaded, config_ok, auth_ok), release version, and still-pending URLs whenever the spinner has not cleared. Then replicate their environment locally using matching feature-flag overrides, browser versions, network throttling, or a VPN in their region, and look up their requests in Cloud Logging by user ID or timestamp.
  • Suppose load-balancer logs reveal that 100% of failed requests routed to a specific group of backend instances—how do you verify why they fail and remediate without causing secondary outages? First diff a failing instance against a healthy one across container image digest, environment variables, mounted secrets, node/zone placement, and outbound network reachability, then prove causality by sending a test request directly to one failing instance (kubectl port-forward on GKE, internal IP on Compute Engine, or a tagged revision URL on Cloud Run) and one healthy instance. Before removing the bad subset, scale up the healthy instances so they have headroom for the incoming traffic spike, then drain and remove the bad instances (letting connection draining finish active requests) and watch user render rates recover toward 100%. Afterward, fix the underlying defect, roll out through a small canary slice, and upgrade readiness checks so an instance that cannot initialize its local config or connection pool never enters the load balancer pool.
  • What frontend coding patterns cause a UI to spin indefinitely instead of surfacing an error state, and how would you harden the client? Browser fetch() has no default timeout, Promise chains with missing error state transitions or swallowed catch blocks leave isLoading = true forever, and failed dynamic import() chunk loads crash component mounting before any fallback UI runs. Fix this by attaching an explicit timeout (such as AbortSignal.timeout(10000)) to every startup request, checking if (!response.ok) explicitly, transitioning catch blocks into a visible error view with a "Retry" button, and wrapping the root view in an error boundary (a wrapper component that catches render exceptions in child components and displays fallback UI instead of a blank or stuck screen). For ChunkLoadError during rolling deploys, trigger a single guarded page reload so the browser fetches the latest index.html and matching bundle hashes.
  • What monitoring, alerting, and rollout safeguards would catch this regression automatically before customers notice? Track a client-side SLI (Service Level Indicator) measuring the ratio of app_rendered beacons to page_boot_started events: at 6,000 page views per hour (100 per minute), an 80% drop triggers ~80 failed boots per minute and fires a high-urgency alert within 2–3 minutes. Pair that with synthetic monitoring (scheduled headless-browser scripts in Google Cloud Monitoring using Puppeteer across multiple regions that load the real URL and assert actual DOM content appears, catching JS/CDN/CORS bugs that plain HTTP 200 pings on index.html miss). Finally, gate every deployment and flag rollout behind automated canary analysis (1% -> 10% -> 50% -> 100%) with per-revision latency and error alerts that halt and roll back long before reaching 80% of users.

Follow-up questions

Similar questions

More Costco interview questions

All 1 Costco questions →