[PR #23054] [CLOSED] fix: Add pagination support to /chats/all endpoint to prevent OOM #65856

Closed
opened 2026-05-06 11:51:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23054
Author: @yang1002378395-cmyk
Created: 3/26/2026
Status: Closed

Base: devHead: fix-chat-oom-v3


📝 Commits (1)

  • be59e10 fix: Add pagination support to /chats/all endpoint to prevent OOM

📊 Changes

1 file changed (+31 additions, -2 deletions)

View changed files

📝 backend/open_webui/routers/chats.py (+31 -2)

📄 Description

Pull Request Checklist

  • Target branch: Targets the dev branch
  • Description: Add pagination support to prevent OOM errors when loading all chats
  • Changelog: Entry added below
  • Testing: Syntax validation passed, logic follows existing pattern
  • Code review: Self-review completed
  • Git Hygiene: Single atomic fix, focused on OOM prevention

Changelog Entry

Description

Add pagination support to the /chats/all endpoint to prevent Out of Memory (OOM) errors for users with many chats.

Fixed

  • Add optional page and limit query parameters to /chats/all endpoint
  • Set default limit of 1000 to prevent memory exhaustion
  • Maintain backward compatibility - response is still a list

Added

  • Pagination parameters for chat list retrieval
  • Documentation explaining the new parameters

Additional Information

Fixes #22206

Root Cause: Users with thousands of chats were experiencing OOM errors when the /chats/all endpoint tried to load all chats into memory at once.

Solution:

  • Add optional page and limit query parameters
  • Default limit of 1000 prevents memory issues
  • Backward compatible: response format unchanged

Testing:

# Test pagination
GET /chats/all  # Returns max 1000 chats (default limit)
GET /chats/all?page=1&limit=100  # Returns first 100 chats
GET /chats/all?page=2&limit=100  # Returns next 100 chats

Contributor License Agreement


🔄 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/23054 **Author:** [@yang1002378395-cmyk](https://github.com/yang1002378395-cmyk) **Created:** 3/26/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix-chat-oom-v3` --- ### 📝 Commits (1) - [`be59e10`](https://github.com/open-webui/open-webui/commit/be59e102109a9f5e02e56b0c0f4e45cf61c73e2b) fix: Add pagination support to /chats/all endpoint to prevent OOM ### 📊 Changes **1 file changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/chats.py` (+31 -2) </details> ### 📄 Description # Pull Request Checklist - [x] **Target branch:** Targets the `dev` branch - [x] **Description:** Add pagination support to prevent OOM errors when loading all chats - [x] **Changelog:** Entry added below - [x] **Testing:** Syntax validation passed, logic follows existing pattern - [x] **Code review:** Self-review completed - [x] **Git Hygiene:** Single atomic fix, focused on OOM prevention # Changelog Entry ### Description Add pagination support to the `/chats/all` endpoint to prevent Out of Memory (OOM) errors for users with many chats. ### Fixed - Add optional `page` and `limit` query parameters to `/chats/all` endpoint - Set default limit of 1000 to prevent memory exhaustion - Maintain backward compatibility - response is still a list ### Added - Pagination parameters for chat list retrieval - Documentation explaining the new parameters --- ### Additional Information Fixes #22206 **Root Cause:** Users with thousands of chats were experiencing OOM errors when the `/chats/all` endpoint tried to load all chats into memory at once. **Solution:** - Add optional `page` and `limit` query parameters - Default limit of 1000 prevents memory issues - Backward compatible: response format unchanged **Testing:** ```python # Test pagination GET /chats/all # Returns max 1000 chats (default limit) GET /chats/all?page=1&limit=100 # Returns first 100 chats GET /chats/all?page=2&limit=100 # Returns next 100 chats ``` ### Contributor License Agreement - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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-06 11:51:58 -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#65856