Add diagnostic endpoints and fix critical issues for Azure Web App cpu-app investigation#101
Draft
Add diagnostic endpoints and fix critical issues for Azure Web App cpu-app investigation#101
Conversation
…vestigation Co-authored-by: mrsharm <68247673+mrsharm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Automated Issue: Investigation Required for Azure Web App cpu-app
Add diagnostic endpoints and fix critical issues for Azure Web App cpu-app investigation
Aug 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This PR addresses performance issues in the Azure Web App
cpu-appby adding diagnostic tools and fixing critical problems that could cause application crashes or resource exhaustion.Root Cause Analysis
Investigation revealed several problematic endpoints that could cause high CPU usage, memory leaks, and application crashes:
/crashendpoint - The conditionwhile (true || bytesSize < 1_000_000)creates an infinite loop, continuously allocating 10MB chunks until the application runs out of memory/workendpoint spawns multiple threads performing intensive mathematical calculationsChanges Made
Fixed Critical Issues
Added Diagnostic Endpoints
GET /api/app/health- Returns quick health status with memory warningsGET /api/app/diagnostics- Provides detailed system metrics, process information, and GC statisticsPOST /api/app/cleanup- Emergency endpoint to clear accumulated memory allocations for recoveryAdded SRE Documentation
Created
SRE_INVESTIGATION_GUIDE.mdwith:Example Usage
The health endpoint will show warnings when memory usage is high:
{ "status": "warning", "warnings": ["High memory usage: 960.0MB", "Memory hog active: 96 allocations"] }Impact
All changes are surgical and focused - existing functionality is preserved while adding essential investigation and recovery capabilities.
Fixes #100.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.