mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[PR #22839] [CLOSED] fix: make RedisDict.set() atomic to prevent intermittent model lookup failures #130543
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/22839
Author: @themavik
Created: 3/19/2026
Status: ❌ Closed
Base:
main← Head:fix/22734-redisdict-atomic-set📝 Commits (1)
6eecb6ffix: make RedisDict.set() atomic to prevent intermittent model lookup failures📊 Changes
1 file changed (+10 additions, -6 deletions)
View changed files
📝
backend/open_webui/socket/utils.py(+10 -6)📄 Description
Summary
Fixes #22734.
Root cause:
RedisDict.set()usedDELETEfollowed byHSETin a non-transactional pipeline. While Redis pipelines batch commands for network efficiency, they do not guarantee atomicity — a concurrentHGET/HGETALLbetween theDELETEandHSETsees an empty hash, causingKeyError/ "Model not found" errors ingenerate_chat_completionandgenerate_follow_upsunder high concurrency (multiple Kubernetes replicas).Fix: Replace the destructive
DELETE+HSETpattern with a diff-based approach:MULTI/EXEC) toHDELonly removed keys andHSETnew/changed keysThis ensures the hash is never empty during updates. Concurrent readers always see either the old state or the new state, never an empty intermediate state.
Changes
backend/open_webui/socket/utils.py: RewroteRedisDict.set()to use diff-based updates with a transactional pipeline instead ofDELETE+HSET.Testing
MULTI/EXEC) guarantees atomicity of theHDEL+HSEToperationsMade with Cursor
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.