mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
## Summary - **Memory leak fix**: Added explicit `LOGGING` config in `settings.py` to prevent unbounded `LogRecord` buffering. Django's `django.request` logger creates WARNING records for 4xx responses with the full `ASGIRequest` (headers, body, payload) pinned in `args`. Without explicit config, Django's default handlers and Sentry's `enable_logs=True` buffer these indefinitely. Setting `django.request` to ERROR level + removing `enable_logs=True` eliminated the leak — load testing showed **84% reduction** in per-request memory growth (7.4 → 1.2 KiB/req). - **Async event loop fix**: Wrapped `parse_and_generate_candidate_schema()` in `asyncio.to_thread()` across all 4 async callers (optimizer, optimizer_line_profiler, jit_rewrite, adaptive_optimizer). This offloads the synchronous libcst parsing + 8-stage postprocessing pipeline to the thread pool, preventing it from blocking the event loop during peak traffic. ## Test plan - [x] All 550 tests pass (`uv run pytest tests/ --ignore=tests/profiling -x -q`) - [ ] Monitor Azure memory alerts after deploy — expect significant reduction in memory growth rate - [ ] Monitor 5xx error rate during peak traffic — expect reduction from event loop no longer blocked by sync postprocessing --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| aiservice | ||
| .dockerignore | ||