Hi @Angel Lan (debug),
Thanks for the question and using MS Q&A platform.
It seems like you're encountering the OutOfMemory (OOM) issue within your Azure App Service, the memory usage charts show no significant spikes or increases, and the app's memory usage appears low.
- Rarely, platform-level restrictions or temporary conditions can cause memory constraints.
- Ensure that your app service plan's memory allocation is not being shared with other apps or services that might be consuming memory.
- Sometimes, memory is distributed among multiple apps on the same plan, which can cause unexpected OOM exceptions.
- Since you've already analyzed the heap snapshot using Visual Studio, consider using more advanced tools like Azure Memory Dump Analysis tool or dotmemory to get a deeper insight into memory usage patterns and identify any hidden issues.
- Turn on Application Insights with memory profiling enabled. This will give you a more granular view of memory allocation and help pinpoint any anomalies. Also, enable crash dumps in the app’s diagnostic settings to capture more data during an OOM event.
- Sometimes, OOM issues are caused by excessive or poorly managed connections (e.g., database connections, HTTP requests). Double-check your connection pooling, timeouts, and retry logic in your code.
- If the issue persists, consider scaling up to a higher-tier App Service Plan or enabling autoscaling to distribute the workload across multiple instances. Optimize memory usage by reviewing caching mechanisms, static data, and third-party libraries.
OOM overview:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview
Diagnostics and solve tool - Azure App Service | Microsoft Learn
Hope the above provided information help in better understanding and help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.