[PR #22842] [CLOSED] fix: make RedisDict.set() atomic to prevent intermittent model lookup failures #130546

Closed
opened 2026-05-21 14:50:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22842
Author: @themavik
Created: 3/19/2026
Status: Closed

Base: devHead: fix/22734-redisdict-atomic-set-v2


📝 Commits (1)

  • 7afeac4 fix: 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() used DELETE followed by HSET in a non-transactional pipeline. A concurrent HGET/HGETALL between the two sees an empty hash, causing "Model not found" errors under high concurrency.

Fix: Replace destructive DELETE + HSET with a diff-based approach using a transactional pipeline (MULTI/EXEC): only HDEL removed keys and HSET new/changed keys.

Changes

  • backend/open_webui/socket/utils.py: Rewrote RedisDict.set() to use diff-based updates with a transactional pipeline.

Testing

  • Verified fix addresses the reported race condition scenario
  • Transactional pipeline guarantees atomicity
  • No behavioral change for single-replica deployments

Made with Cursor


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22842 **Author:** [@themavik](https://github.com/themavik) **Created:** 3/19/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/22734-redisdict-atomic-set-v2` --- ### 📝 Commits (1) - [`7afeac4`](https://github.com/open-webui/open-webui/commit/7afeac420be0f2ef6d2851ea886c154970cbba39) fix: make RedisDict.set() atomic to prevent intermittent model lookup failures ### 📊 Changes **1 file changed** (+10 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/socket/utils.py` (+10 -6) </details> ### 📄 Description ## Summary Fixes #22734. **Root cause:** `RedisDict.set()` used `DELETE` followed by `HSET` in a non-transactional pipeline. A concurrent `HGET`/`HGETALL` between the two sees an empty hash, causing "Model not found" errors under high concurrency. **Fix:** Replace destructive `DELETE` + `HSET` with a diff-based approach using a transactional pipeline (`MULTI`/`EXEC`): only `HDEL` removed keys and `HSET` new/changed keys. ## Changes - `backend/open_webui/socket/utils.py`: Rewrote `RedisDict.set()` to use diff-based updates with a transactional pipeline. ## Testing - Verified fix addresses the reported race condition scenario - Transactional pipeline guarantees atomicity - No behavioral change for single-replica deployments Made with [Cursor](https://cursor.com) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 14:50:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#130546