Commit a217804
committed
Fixes #4852: Add performance safeguards to prevent apply_diff hanging on large XML files
- Added maximum iteration limit (10,000) to fuzzySearch function
- Added 5-second timeout mechanism for very large files
- Added early exit when perfect matches are found
- Added performance logging for debugging large file issues
- Applied fixes to both MultiSearchReplaceDiffStrategy and MultiFileSearchReplaceDiffStrategy
- Added comprehensive test suite to verify the fix works correctly
The issue was caused by the middle-out search algorithm in fuzzySearch()
potentially running millions of iterations on large files without any
performance constraints, leading to indefinite hanging.1 parent 2e2f83b commit a217804
File tree
4 files changed
+1094
-2
lines changed- src/core/diff/strategies
- __tests__
4 files changed
+1094
-2
lines changed
0 commit comments