Skip to content

Fix: Resolve OOM DoS Vulnerability and Optimize FAISS I/O Caching (Clean)#294

Open
Adar5 wants to merge 4 commits intojenkinsci:mainfrom
Adar5:fix/rag-oom-clean
Open

Fix: Resolve OOM DoS Vulnerability and Optimize FAISS I/O Caching (Clean)#294
Adar5 wants to merge 4 commits intojenkinsci:mainfrom
Adar5:fix/rag-oom-clean

Conversation

@Adar5
Copy link
Contributor

@Adar5 Adar5 commented Mar 17, 2026

Per Leo's suggestion, I am opening this clean branch to isolate only the necessary fixes for the OOM vulnerability and FAISS caching, leaving behind any unrelated noisy commits from the previous PR.

Key Changes:

OOM DoS Mitigation (Defense-in-Depth):

Implemented a strict 2000-character truncation shield on all input gateways (Standard Chat, WebSockets, and File Upload endpoints) to prevent massive string payloads from exhausting RAM.

Migrated from ConversationBufferMemory to ConversationBufferWindowMemory(k=10) to bound the session history, preventing long conversations from causing gradual memory leaks while preserving the secure persistence feature.

FAISS I/O Caching:

Applied @lru_cache(maxsize=1) strictly to the FAISS index and metadata loaders to prevent redundant disk reads.

Refactored dynamic loggers out of the RAG cache boundary to resolve unhashable type errors during inference.

Test Suite Modernization:

Consolidated pytest_plugins from nested conftest.py files into a single root-level conftest.py to fix collection errors in newer Pytest versions (8.4.1+).

Testing:

Successfully survived local stress testing using extreme multi-megabyte payload scripts without causing Uvicorn crashes or memory exhaustion.

Full test suite passing locally (161/161 passed).

@Adar5 Adar5 requested a review from a team as a code owner March 17, 2026 05:57
@Adar5 Adar5 force-pushed the fix/rag-oom-clean branch from fc4181d to 360bc21 Compare March 17, 2026 06:00
@Adar5 Adar5 force-pushed the fix/rag-oom-clean branch from 360bc21 to ae2cec8 Compare March 17, 2026 06:06
@berviantoleo berviantoleo added the bug For changelog: Minor bug. Will be listed after features label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants