[GH-ISSUE #23540] issue: Memory leak in aiohttp ClientSession — sessions not cleaned up under concurrent API load #74613

Closed
opened 2026-05-13 07:25:08 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @Sechma on GitHub (Apr 9, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23540

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

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

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

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:


CONTAINER ID   NAME              CPU %     MEM USAGE / LIMIT   MEM %     NET I/O           BLOCK I/O
xxxx open-webui   31.85%    27.52GiB / 32GiB    85.99%    18.2GB / 2.71GB   262MB / 1.04GB

No OOM kills, no container restarts, memory simply accumulates.

Additional Information

No response

Originally created by @Sechma on GitHub (Apr 9, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23540 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### 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 - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### 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: ``` CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O xxxx open-webui 31.85% 27.52GiB / 32GiB 85.99% 18.2GB / 2.71GB 262MB / 1.04GB ``` No OOM kills, no container restarts, memory simply accumulates. ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-13 07:25:08 -05:00
Author
Owner

@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:

Sechma created an issue (open-webui/open-webui#23540)
https://github.com/open-webui/open-webui/issues/23540
Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and
    found no related items (your issue might already be addressed on the
    development branch!).
  • I am using the latest version of Open WebUI.

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

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and
    environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting,
    environment variable, and command-line option that influences my setup

    (such as Docker Compose overrides, .env values, browser settings,
    authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are
    precise, sequential, and leave nothing to interpretation
    . My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords
    if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

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:

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
xxxx open-webui 31.85% 27.52GiB / 32GiB 85.99% 18.2GB / 2.71GB 262MB / 1.04GB

No OOM kills, no container restarts, memory simply accumulates.
Additional Information

No response


Reply to this email directly, view it on GitHub
https://github.com/open-webui/open-webui/issues/23540, or unsubscribe
https://github.com/notifications/unsubscribe-auth/B7HYZ6OTMLIWW6X3JSQ4S3L4U6E23AVCNFSM6AAAAACXSNYCT2VHI2DSMVQWIX3LMV43ASLTON2WKOZUGIZTCOJRGY4DKMI
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

<!-- gh-comment-id:4215053078 --> @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: > *Sechma* created an issue (open-webui/open-webui#23540) > <https://github.com/open-webui/open-webui/issues/23540> > Check Existing Issues > > - I have searched for any existing and/or related issues. > - I have searched for any existing and/or related discussions. > - I have also searched in the CLOSED issues AND CLOSED discussions and > found no related items (your issue might already be addressed on the > development branch!). > - I am using the latest version of Open WebUI. > > 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 > > - I have read and followed all instructions in README.md. > - I am using the latest version of *both* Open WebUI and Ollama. > - I have included the browser console logs. > - I have included the Docker container logs. > - I have *provided every relevant configuration, setting, and > environment variable used in my setup.* > - I have clearly *listed every relevant configuration, custom setting, > environment variable, and command-line option that influences my setup* > (such as Docker Compose overrides, .env values, browser settings, > authentication configurations, etc). > - I have documented *step-by-step reproduction instructions that are > precise, sequential, and leave nothing to interpretation*. My steps: > - Start with the initial platform/version/OS and dependencies used, > - Specify exact install/launch/configure commands, > - List URLs visited, user input (incl. example values/emails/passwords > if needed), > - Describe all options and toggles enabled or changed, > - Include any files or environmental changes, > - Identify the expected and actual result at each stage, > - Ensure any reasonably skilled user can follow and hit the same issue. > > 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: > > > CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O > xxxx open-webui 31.85% 27.52GiB / 32GiB 85.99% 18.2GB / 2.71GB 262MB / 1.04GB > > No OOM kills, no container restarts, memory simply accumulates. > Additional Information > > *No response* > > — > Reply to this email directly, view it on GitHub > <https://github.com/open-webui/open-webui/issues/23540>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/B7HYZ6OTMLIWW6X3JSQ4S3L4U6E23AVCNFSM6AAAAACXSNYCT2VHI2DSMVQWIX3LMV43ASLTON2WKOZUGIZTCOJRGY4DKMI> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
Author
Owner

@Classic298 commented on GitHub (Apr 9, 2026):

@trevorhayes6561-maker stop spamming meaningless comments under new issues.

<!-- gh-comment-id:4215235634 --> @Classic298 commented on GitHub (Apr 9, 2026): @trevorhayes6561-maker stop spamming meaningless comments under new issues.
Author
Owner

@tjbck commented on GitHub (Apr 12, 2026):

Addressed in dev.

<!-- gh-comment-id:4232868661 --> @tjbck commented on GitHub (Apr 12, 2026): Addressed in dev.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#74613