get_reranker() acquires the module-level _lock and then, on first load, calls unload() to clear any stale state before _load() instantiates the CrossEncoder. unload() acquires the same _lock — but threading.Lock is non-reentrant, so the second acquisition by the holding thread blocked forever. Symptom: rerank=True hung the search_knowledge_base tool with no further log output past 'rerank entered'. Switch to threading.RLock so the same thread can re-enter without blocking. unload()'s independent callers still work the same way; the only behaviour change is that re-entrant acquisition from one thread now succeeds. |
||
|---|---|---|
| .. | ||
| assets | ||
| auth | ||
| core | ||
| loggers | ||
| models | ||
| plugins | ||
| requirements | ||
| routes | ||
| state | ||
| storage | ||
| tests | ||
| utils | ||
| __init__.py | ||
| _platform_compat.py | ||
| colab.py | ||
| main.py | ||
| run.py | ||
| startup_banner.py | ||