mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-02 06:39:02 -05:00
[GH-ISSUE #23540] issue: Memory leak in aiohttp ClientSession — sessions not cleaned up under concurrent API load #123321
Reference in New Issue
Block a user
Originally created by @Sechma on GitHub (Apr 9, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23540
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.8.12
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04 (Docker host)
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
After handling concurrent API requests to /api/chat/completions, memory usage should return to baseline once all requests complete. aiohttp.ClientSession objects should be properly closed and garbage collected regardless of whether responses are streaming or non-streaming.
Actual Behavior
Memory usage grows continuously under concurrent API load and never returns to baseline. After 1 hour of load testing (50 concurrent requests, repeated), memory grew from 14.4 GB to 27.5 GB
Under extreme concurrent load (300+ requests), we also see
chat_completion() missing 1 required positional argument: 'request'
Steps to Reproduce
1 Deploy Open WebUI v0.8.12 via Docker with UVICORN_WORKERS=16 and AIOHTTP_CLIENT_TIMEOUT=600
2 Configure an OpenAI-compatible LLM backend
3 Send 50 concurrent POST requests to /api/chat/completions with large payloads (e.g. translation batch 100 items across 5 locales each)
4 Repeat the batch 3–5 times
5 Observe docker stats — memory grows with each batch and never decreases
6 After ~500 total requests, memory reaches 27+ GB
Logs & Screenshots
Docker stats after 1 hour of load testing:
No OOM kills, no container restarts, memory simply accumulates.
Additional Information
No response
@trevorhayes6561-maker commented on GitHub (Apr 9, 2026):
Thanks for reporting this issue regarding the memory leak in
aiohttp.ClientSession under concurrent load.
On Thu, Apr 9, 2026, 7:49 AM Marek Sechra @.***> wrote:
@Classic298 commented on GitHub (Apr 9, 2026):
@trevorhayes6561-maker stop spamming meaningless comments under new issues.
@tjbck commented on GitHub (Apr 12, 2026):
Addressed in dev.