NokiaTube | New address | Mode Phone | On high quality
Skip to content

[Generated by SRE Agent] fix: remove unbounded RequestDataCache causing OOM in CartController - #8

Open
AlahmadiQ8 wants to merge 1 commit into
mainfrom
sre-agent/fix-cart-memory-leak
Open

AlahmadiQ8 wants to merge 1 commit into
mainfrom
sre-agent/fix-cart-memory-leak

Conversation

@AlahmadiQ8

Copy link
Copy Markdown
Owner

Summary

Removes the static List<byte[]> RequestDataCache from CartController.cs that was causing System.OutOfMemoryException and HTTP 5xx errors.

Problem

Every POST /api/cart/{userId}/items call allocated a 10MB byte[] buffer and appended it to a static list with no eviction or cleanup. After ~75 requests, the cache consumed 750MB — approaching the container's 1Gi memory limit — causing OOM exceptions on all subsequent requests.

This bug caused two incidents today (2026-09-28):

  • Initial OOM storm at ~08:08–08:14 UTC (peak: 159 errors/min)
  • Second burst at ~09:19 UTC triggering alert alert-http-5xx-sre-lab

Changes

  • Removed private static readonly List<byte[]> RequestDataCache field (line 14)
  • Removed the 10MB allocation, .Add() call, and cache-size logging in AddItemToCart() (lines 29–35)

No functional behavior changes — the cache served no actual analytics purpose.

Testing

  • No existing tests reference RequestDataCache or depend on the removed code
  • Cart add/update/remove operations are unaffected (verified by reading remaining code paths)

Fixes #7


Created by Azure SRE Agent: Open thread

Remove the static List<byte[]> RequestDataCache that allocated a 10MB
buffer on every POST /api/cart/{userId}/items call without cleanup.
This caused System.OutOfMemoryException after ~75 requests (750MB),
crashing all API endpoints with HTTP 5xx errors.

Fixes #7

Co-authored-by: Azure SRE Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incident: HTTP 5xx due to OutOfMemoryException in Cart API (Grubify Container App)

2 participants