Repository navigation
[Generated by SRE Agent] fix: remove unbounded RequestDataCache causing OOM in CartController - #8
Open
AlahmadiQ8 wants to merge 1 commit into
Open
AlahmadiQ8 wants to merge 1 commit into
AlahmadiQ8 wants to merge 1 commit into
Conversation
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the static
List<byte[]> RequestDataCachefromCartController.csthat was causingSystem.OutOfMemoryExceptionand HTTP 5xx errors.Problem
Every
POST /api/cart/{userId}/itemscall allocated a 10MBbyte[]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):
alert-http-5xx-sre-labChanges
private static readonly List<byte[]> RequestDataCachefield (line 14).Add()call, and cache-size logging inAddItemToCart()(lines 29–35)No functional behavior changes — the cache served no actual analytics purpose.
Testing
RequestDataCacheor depend on the removed codeFixes #7
Created by Azure SRE Agent: Open thread