You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(analytics): pattern analysis has no cooperative cancel token; executor threads outlive the request deadline #22094
CodePatternAnalyzer.analyze_directory (autobot-backend/code_intelligence/pattern_analysis/analyzer.py) has no cooperative cancel token. Only the clone-detection phase carries a deadline (ANALYZER_TIMEOUT); the other phases run file work through run_in_executor with none. The report route bounds the whole analysis with an outer asyncio.wait_for of about 180 s, which stops the awaiting coroutine but not the executor threads: they keep walking the tree after the request has been answered. _get_api_endpoint_analysis already solves the same shape with new_cancel_token / run_cancellable (utils/cancel_tokens.py).
Fix
Give the pattern analyzer a cancel token checked between files and phases, and have _get_pattern_analysis in endpoints/report.py create one with new_cancel_token and cancel it when the outer deadline fires, as _get_api_endpoint_analysis does.
Context
Found while removing the "scan only AutoBot's backend directory" shortcut from the report (#20513, PR #22092): with it gone, a large source relies on this deadline.
Activity