mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #18207] [CLOSED] Fix Memory Leak and NUL Character Issues in Google PSE Web Search #40335
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/18207
Author: @lokiee0
Created: 10/10/2025
Status: ❌ Closed
Base:
main← Head:fix-web-search-memory-leak-nul-chars📝 Commits (4)
5f584abAdd setup documentation and configuration files66e1360Fix memory leak and NUL character issues in web search924c849Add comprehensive pull request template for web search fix31fe01cAdd CLA text to pull request template📊 Changes
11 files changed (+809 additions, -560 deletions)
View changed files
➕
FIX_MEMORY_LEAK_AND_NUL_CHARS.md(+57 -0)➕
PULL_REQUEST_TEMPLATE.md(+91 -0)➕
SETUP_STATUS.md(+125 -0)📝
backend/open_webui/retrieval/vector/dbs/pgvector.py(+6 -2)📝
backend/open_webui/retrieval/vector/utils.py(+30 -3)📝
backend/open_webui/routers/retrieval.py(+49 -22)➕
litellm_config.yaml(+23 -0)📝
package-lock.json(+113 -533)📝
package.json(+1 -0)➕
test_backend.py(+95 -0)➕
test_web_search_fix.py(+219 -0)📄 Description
Fix Memory Leak and NUL Character Issues in Google PSE Web Search
🐛 Issue Description
Fixes critical issues with Google PSE (Programmable Search Engine) web search functionality:
Related Issue: #18201
🔧 Root Cause Analysis
✅ Solution Implemented
1. NUL Character Cleaning
backend/open_webui/retrieval/vector/utils.pyclean_text_for_postgres()function to remove problematic charactersprocess_metadata()to clean both keys and values2. Database Insertion Fix
backend/open_webui/retrieval/vector/dbs/pgvector.py3. Memory Management & Batching
backend/open_webui/routers/retrieval.py📊 Performance Impact
🧪 Testing
Validation Test Suite
test_web_search_fix.pyManual Testing
🔄 Backward Compatibility
📁 Files Changed
backend/open_webui/retrieval/vector/utils.py- Text cleaning utilitiesbackend/open_webui/retrieval/vector/dbs/pgvector.py- Database insertion fixbackend/open_webui/routers/retrieval.py- Memory management and batchingFIX_MEMORY_LEAK_AND_NUL_CHARS.md- Comprehensive documentationtest_web_search_fix.py- Validation test suite🚀 Deployment Notes
📈 Monitoring Recommendations
docker statsor system monitoring📝 Contributor License Agreement
contributor license agreement
This fix resolves a critical production issue affecting server stability and should be prioritized for merge.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.