mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[PR #24928] feat: configurable aiohttp read_bufsize via AIOHTTP_READ_BUFSIZE env #131597
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/24928
Author: @shoemoney
Created: 5/19/2026
Status: 🔄 Open
Base:
dev← Head:feat/aiohttp-read-bufsize-env-v2📝 Commits (1)
d1a8722feat: configurable aiohttp read_bufsize via AIOHTTP_READ_BUFSIZE env📊 Changes
2 files changed (+23 additions, -1 deletions)
View changed files
📝
backend/open_webui/env.py(+14 -0)📝
backend/open_webui/utils/session_pool.py(+9 -1)📄 Description
Problem
The shared
aiohttp.ClientSessioninutils/session_pool.pyis created with the library defaultread_bufsize(64 KiB). Some upstream providers emit a single SSE chunk that exceeds this ceiling, causing the stream to fail with:(The 131072 = 2 × 64 KiB comes from aiohttp internally doubling the buffer once before raising.)
Triggers seen in the wild
There is no current env or config knob to override this; the only workaround is patching the source.
Fix
Expose
AIOHTTP_READ_BUFSIZE(default 1 MiB) and pass it through toClientSession(read_bufsize=...).Files
backend/open_webui/env.py— new env constant with validation.backend/open_webui/utils/session_pool.py— import it, pass toClientSession, update docstring + log line.Validated against
Reproduced the failure with
moonshotai/kimi-k2.6via OpenRouter (Novita provider) onv0.9.5. With the default 64 KiB buffer the stream dies mid-reasoning; withAIOHTTP_READ_BUFSIZE=1048576(or the new default) the stream completes cleanly throughdata: [DONE].Related: #24543
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.