Files
open-webui-custom/backend/open_webui/routers
Classic298 8cf32ae2a7 fix: prevent worker death during document upload by using run_coroutine_threadsafe (#21158)
* fix: prevent worker death during document upload by using run_coroutine_threadsafe

Replace asyncio.run() with asyncio.run_coroutine_threadsafe() in
save_docs_to_vector_db() to prevent uvicorn worker health check failures.

The issue: asyncio.run() creates a new event loop and blocks the thread
completely, preventing the worker from responding to health checks during
long-running embedding operations (>5 seconds default timeout).

The fix: Schedule the async embedding work on the main event loop using
run_coroutine_threadsafe(). This keeps the main loop responsive to health
check pings while the sync caller waits for the result.

Changes:
- main.py: Store main event loop reference in app.state.main_loop at startup
- retrieval.py: Use run_coroutine_threadsafe() instead of asyncio.run()

https://claude.ai/code/session_01UQSYvSTkXb57sFb7M85Kcw

* add env var

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-12 15:22:57 -06:00
..
2026-02-11 16:24:11 -06:00
2026-02-11 17:56:49 -06:00
2026-02-11 18:25:37 -06:00
2026-02-11 16:24:11 -06:00
2026-01-29 18:51:02 +04:00
2026-01-22 03:11:33 +04:00
2026-01-09 20:44:31 +04:00
2026-02-09 13:28:14 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 15:55:23 -06:00
2026-02-12 12:07:45 -06:00
2026-02-11 16:24:11 -06:00
2026-02-12 11:01:46 -06:00
2026-02-12 11:04:34 -06:00
2026-02-11 18:24:30 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00
2026-02-11 16:24:11 -06:00