open-webui/backend
Claude a03bde4701
fix(db): tighten aiosqlite terminate-shim install scope and worker wake-up
Address PR review findings on the original shim:

1. Source-shape gating (avoid shadowing future upstream fixes)
   The install now inspects the original implementation source and
   only patches when it actually references `self._connection.stop` —
   the buggy pattern this shim exists to fix. If a newer SQLAlchemy
   ships a working `_terminate_force_close` we leave it alone.

2. Wake the aiosqlite worker, don't just flag it
   In aiosqlite ≥0.20 the worker thread blocks on `_tx.get()`. Setting
   `_running = False` alone never unblocks it — the queue needs a
   sentinel push for the loop to observe the flag. The replacement
   now puts `(None, None)` onto `_tx` first and then flips
   `_running`, so the worker exits promptly instead of relying on a
   subsequent unrelated queue item or GC.

3. Conditional install (no global mutation on non-sqlite deployments)
   Move `_install_aiosqlite_compat()` inside the
   `if 'sqlite' in ASYNC_SQLALCHEMY_DATABASE_URL` branch in
   `internal/db.py`, so PostgreSQL / MySQL / etc. deployments get no
   SQLAlchemy monkey-patch at all.

https://claude.ai/code/session_01JSr4NZSskEUQvoJnavVXh8
2026-04-14 12:41:35 +00:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui fix(db): tighten aiosqlite terminate-shim install scope and worker wake-up 2026-04-14 12:41:35 +00:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh refac 2026-03-24 19:43:30 -05:00
requirements-min.txt refac 2026-04-13 23:40:09 -05:00
requirements.txt refac 2026-04-13 23:40:09 -05:00
start.sh refac 2026-03-24 19:43:30 -05:00
start_windows.bat refac 2026-03-24 19:43:30 -05:00