Skip to content

Instantly share code, notes, and snippets.

View cphillips83's full-sized avatar

Chris Phillips cphillips83

View GitHub Profile
function k { kubectl @args }
function kl { kubectl logs @args }
function kg { kubectl get @args }
function kd { kubectl describe @args }
function ke { kubectl exec -it @args -- sh }
function kaf { kubectl apply -f @args }
function kdf { kubectl delete -f @args }
@cphillips83
cphillips83 / debugging-requestcontext-leak.md
Created February 6, 2026 05:55
Debugging a RequestContext Memory Leak with AI Assistance - A case study in human-AI collaboration

Debugging a RequestContext Memory Leak with AI Assistance

TL;DR

A senior developer and Claude AI collaborated to diagnose and fix a memory leak in an ASP.NET application where RequestContext objects were being created but not torn down. The fix took ~2 hours of iterative debugging, not "ask AI and done." This document shows how AI assistance requires domain expertise to be effective.

The Problem

ActiveContextCount kept climbing from 1 to 139+ without returning to baseline. Requests were being set up but not torn down, causing a memory/connection leak.

-- Fix: add missing index on orders.status for active order queries
-- Author: DBA Team
-- Date: 2026-03-16
BEGIN;
CREATE INDEX CONCURRENTLY idx_orders_status
ON orders(status)
WHERE status != 'completed';