run compute_simhash and collapse_urls in the thread executor#3331
Open
liquidsec wants to merge 1 commit into
Open
run compute_simhash and collapse_urls in the thread executor#3331liquidsec wants to merge 1 commit into
liquidsec wants to merge 1 commit into
Conversation
waf_bypass was submitting compute_simhash on full response bodies through the process pool. xxhash releases the GIL and simhash truncates its input to 3 KB internally, so the pickle-to-worker cost dominated the actual work, and any wedged worker could stall the whole scan for 300 s before helper._reset_process_pool recovered. bevigil.collapse_urls had the same profile at smaller scale. Neither operation needs process isolation. Move both to run_in_executor_cpu so a hung callable can no longer trigger a pool reset. Kreuzberg PDF extraction and badsecrets retain run_in_executor_mp where crash isolation is load-bearing.
Contributor
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary+ 1 improvement 🚀
30 unchanged ✅🔍 Significant Changes (>10%)
🐍 Python Version 3.11.15 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3331 +/- ##
=====================================
- Coverage 90% 90% -0%
=====================================
Files 450 450
Lines 46285 46285
=====================================
- Hits 41547 41537 -10
- Misses 4738 4748 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
waf_bypasssubmitscompute_simhashon full HTTP response bodies through the process pool.xxhashreleases the GIL andcompute_simhashtruncates its input to 3 KB internally, so the pickle-to-worker IPC dominates the actual work.helper._reset_process_pool, which fires 300 s after the stall. On a real 14 h scan against a large target set this pattern was observed to stall the pipeline for the full timeout window before the reset recovered.bevigil.collapse_urlswas on the same pattern at smaller scale.run_in_executor_cpu(the thread pool).kreuzbergPDF extraction andbadsecretsstay onrun_in_executor_mp-- crash isolation from adversarial input is the point there.Changes
bbot/modules/waf_bypass.py: tworun_in_executor_mp(compute_simhash, ...)sites moved torun_in_executor_cpubbot/modules/bevigil.py:run_in_executor_mp(collapse_urls, ...)moved torun_in_executor_cpu