Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Soak: enhanced RSS leak detection with first/last ratio check
Martin Vogel47592c6927ff
diff --git a/scripts/soak-test.sh b/scripts/soak-test.shindex c11e0364a..3b0a74b87 100755--- a/scripts/soak-test.sh+++ b/scripts/soak-test.sh@@ -371,21 +371,24 @@ FINAL_DIAG="/tmp/cbm-diagnostics-${SERVER_PID}.json"PASS=true-# Check 1: RSS growth-# For short runs (<10min): check absolute ceiling (warmup noise dominates slope)-# For long runs (>=10min): use linear regression on post-warmup samples (skip first 20%)+# Check 1: Memory leak detection via RSS trend+# This is the primary leak detector on ALL platforms (including Windows+# where LeakSanitizer is unavailable). Catches both linear leaks (slope)+# and step-function leaks (first vs last comparison).TOTAL_SAMPLES=$(awk -F, 'NR>1 && $3>0 { n++ } END { print n+0 }' "$METRICS_CSV")MAX_RSS=$(awk -F, 'NR>1 && $3>0 { if ($3>max) max=$3 } END { printf "%.0f", max/1024/1024 }' "$METRICS_CSV")-echo "RSS max: ${MAX_RSS}MB (${TOTAL_SAMPLES} samples)" | tee -a "$SUMMARY"+FIRST_RSS=$(awk -F, 'NR==2 && $3>0 { printf "%.0f", $3/1024/1024 }' "$METRICS_CSV")+LAST_RSS=$(awk -F, '$3>0 { last=$3 } END { printf "%.0f", last/1024/1024 }' "$METRICS_CSV")+echo "RSS: first=${FIRST_RSS}MB last=${LAST_RSS}MB max=${MAX_RSS}MB (${TOTAL_SAMPLES} samples)" | tee -a "$SUMMARY"if [ "$DURATION_MIN" -lt 10 ]; then- # Short run: absolute ceiling check- if [ "${MAX_RSS:-0}" -gt 100 ] 2>/dev/null; then- echo "FAIL: RSS ${MAX_RSS}MB > 100MB ceiling" | tee -a "$SUMMARY"+ # Short run: absolute ceiling (warmup noise dominates slope)+ if [ "${MAX_RSS:-0}" -gt 200 ] 2>/dev/null; then+ echo "FAIL: RSS ${MAX_RSS}MB > 200MB ceiling" | tee -a "$SUMMARY"PASS=falsefielse- # Long run: slope after skipping warmup (first 20% of samples)+ # Long run: linear regression on post-warmup samples (skip first 20%)RSS_SLOPE=$(awk -F, -v skip="$((TOTAL_SAMPLES / 5))" 'NR>1 && $3>0 {row++@@ -399,7 +402,17 @@ else}' "$METRICS_CSV")echo "RSS slope (post-warmup): ${RSS_SLOPE} KB/hr" | tee -a "$SUMMARY"if [ "${RSS_SLOPE:-0}" -gt 500 ] 2>/dev/null; then- echo "FAIL: RSS slope ${RSS_SLOPE} KB/hr > 500 KB/hr threshold" | tee -a "$SUMMARY"+ echo "FAIL: RSS slope ${RSS_SLOPE} KB/hr > 500 KB/hr" | tee -a "$SUMMARY"+ PASS=false+ fi+fi++# Check 1b: RSS ratio (last / first) — catches step-function leaks+if [ "${FIRST_RSS:-0}" -gt 0 ] 2>/dev/null; then+ RSS_RATIO=$(awk "BEGIN { printf \"%.1f\", ${LAST_RSS} / ${FIRST_RSS} }")+ echo "RSS ratio (last/first): ${RSS_RATIO}x" | tee -a "$SUMMARY"+ if awk "BEGIN { exit (${LAST_RSS} / ${FIRST_RSS} > 3.0) ? 0 : 1 }" 2>/dev/null; then+ echo "FAIL: RSS grew ${RSS_RATIO}x (last=${LAST_RSS}MB vs first=${FIRST_RSS}MB)" | tee -a "$SUMMARY"PASS=falsefifi