fix(searcher): bound per-path wait and non-blocking shutdown - #2194
Open
RerankerGuo wants to merge 1 commit into
Open
fix(searcher): bound per-path wait and non-blocking shutdown#2194RerankerGuo wants to merge 1 commit into
RerankerGuo wants to merge 1 commit into
Conversation
Searcher._retrieve_paths previously joined every retrieval path with Future.result() (no timeout) inside a ContextThreadPoolExecutor context-manager, so a single slow / blocked path (e.g. a hanging Neo4j or HTTP call) would stall the whole searcher and pin worker threads until process exit. Add a per-path timeout (30s) on each future and release the pool via executor.shutdown(wait=False) in a finally block, guaranteeing no thread leak on any pathological path. Added a unit test covering the slow-path branch. Closes MemTensor#2134.
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
Future.result()wait to 30s so a slow / blocked path (e.g. hanging Neo4j / HTTP call) cannot stall the whole searcher.with ContextThreadPoolExecutor(...)block with explicitexecutor.shutdown(wait=False)in afinally:block so straggling threads never pin the pool._retrieve_pathsreturns even when one path is artificially slow.Closes #2134.
Verification
ruff format/ruff checkclean on changed lines.test_retrieve_paths_timeout_releases_executorsimulates a 5s-hanging path and asserts the total elapsed is well below the 30s bound.Checklist