Skip to content

Incident: HTTP 5xx during deployment — Datadog sidecar crash-loop & latent memory leak (2026-09-28) #329

Description

@dajwalia-ms

Incident Report: HTTP 5xx during deployment — Datadog agent sidecar crash-loop

  • Incident ID: fe518660-7b59-4bac-a225-6a1a0c72f000
  • Service: Azure Container Apps — ca-grubify-ijid2sq6n3hr6 (rg: rg-sre-lab02)
  • Subscription: a9096d06-8ee3-4532-9b34-aa3bb3570226
  • FQDN: ca-grubify-ijid2sq6n3hr6.victoriousmeadow-21ce84b0.eastus2.azurecontainerapps.io
  • Active revision: ca-grubify-ijid2sq6n3hr6--0000006 (100% traffic)

Summary

HTTP 5xx errors were triggered during a deployment that created new revisions (0000005 → 0000006) with a misconfigured datadog/agent:7 sidecar container. The Datadog agent immediately entered a crash-loop (ContainerBackOff) due to missing DD_HOSTNAME environment variable, causing transient 5xx responses during the revision transition. The Grubify API container itself started successfully and is serving HTTP 200.

Impact

  • Transient 5xx errors during ~3-minute deployment window (15:19–15:23 UTC)
  • 21 requests observed in the affected window (11 + 10 in two 5-min buckets)
  • Datadog agent sidecar is still crash-looping (wasting resources, no APM telemetry)
  • Latent risk: The deployed image grubify-api:dd-instrumented likely still contains the CartController memory leak (10MB/request unbounded allocation — see [Incident] Recurring memory leak in CartController.AddItemToCart causing HTTP 5xx #318)

Timeline (UTC)

  • ~15:19:29: First containerApps/write operation (caller: 4ace62cf-...) — created revision 0000005
  • ~15:20:37: Second containerApps/write operation — created revision 0000006
  • ~15:20:42: Revision --0000006 created (image: grubify-api:dd-instrumented + datadog/agent:7 sidecar)
  • ~15:20:51: Grubify API container started successfully on port 8080
  • ~15:20:53: Traffic weight set to 100% for revision 0000006; old revision 0000005 decommissioned
  • ~15:21:00: Datadog agent sidecar begins crash-looping (hostname resolution failure)
  • ~15:23:12: First ContainerBackOff warning — "Persistent Failure to start container"
  • ~15:23:29: Alert alert-http-5xx-sre-lab02 fired (Sev3)
  • ~15:23:55: Alert auto-resolved
  • ~15:24:36: Second ContainerBackOff event (sidecar still crash-looping)

Evidence

System logs (revision 0000006)

ContainerBackOff | Persistent Failure to start container (count: 2)

Datadog agent errors (sidecar)

Error: Error while getting hostname, exiting: unable to reliably determine the host name.
You can define one in the agent config file or in your hosts file
Error: couldn't get hostname from core agent at "/opt/datadog-agent/bin/agent/agent": exit status 255.
Set DD_HOSTNAME or hostname in the agent config

Metrics snapshot (Azure Monitor)

  • Requests (1m bins, 15:10–15:24): 0,0,0,0,0,0,0,11,0,0,0,10,0,0,0
  • RestartCount (5m bins, 15:00–15:20): max 1, 0, 1, 1, 1 (sidecar restarts)
  • App container: Running, HTTP 200 verified on /api/restaurants (473ms) and /api/fooditems (200)

Current CartController.cs (repo main branch)

The memory leak code is still present in the source:

private static readonly List<byte[]> RequestDataCache = new();
// ...
var requestData = new byte[10 * 1024 * 1024]; // 10MB buffer
RequestDataCache.Add(requestData);

Root Cause

Primary: A deployment at 15:19–15:20 UTC added a datadog/agent:7 sidecar container without configuring the required DD_HOSTNAME environment variable. The sidecar immediately crash-looped, and during the revision transition window, incoming requests received 5xx responses before the new revision's main container was fully ready.

Secondary (latent): The deployed grubify-api:dd-instrumented image and the source repo (main branch) still contain the CartController memory leak (static unbounded List<byte[]> with 10MB allocations per POST request). This will cause OutOfMemoryException and HTTP 5xx under sustained POST /api/cart traffic. See #318.

Remediation

  • Sidecar fix: Set DD_HOSTNAME environment variable on the datadog-agent container (e.g., via az containerapp update with container env vars, or use DD_HOSTNAME set to the container app name)
  • Memory leak fix: Remove RequestDataCache and 10MB allocation from CartController.AddItemToCart — code fix still pending from [Incident] Recurring memory leak in CartController.AddItemToCart causing HTTP 5xx #318
  • Deployment: Rebuild and push a fixed container image to ACR

Action Items

# Action Priority
1 Set DD_HOSTNAME env var on datadog-agent sidecar to stop crash-loop High
2 Remove memory leak from CartController.cs and deploy fixed image (#318) High
3 Add deployment validation checks to prevent misconfigured sidecars Medium
4 Add pre-deployment smoke tests before shifting traffic to new revisions Medium

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions