Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.2 KB
Raw Blame

Follow-up to the #6095 FastAPI worker DB session cleanup: bounded a multi-user pool-exhaustion vector where two of the library API's per-item loops (the library index route, /library/api/documents, POST /library/api/sync-library) could each pin one extra pooled connection per LRU eviction of another user's cached session on the same worker, and added cleanup when a suspended stream iterator is closed or finalized. This does not establish immediate iterator closure on client disconnect.

Behaviour note: this wrapper's GeneratorExit handler gives the wrapped generator a cleanup boundary whenever the wrapper itself is closed or finalized, closing the wrapped generator inside that boundary. If a streamed body's own finally raises during that close, the exception propagates out of close() instead of being silently swallowed. That guarantee only covers the close path itself, though: starlette's iterate_in_threadpool (which drives every production StreamingResponse body) never explicitly calls close() on its source iterator, so on the production path this wrapper -- and any such error -- is only closed at garbage collection, where a raising close() is again reported as an "Exception ignored" message rather than surfaced to a caller.