mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #21411] bug: File descriptor leak in audio.py and pipelines.py — open() without close #34997
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?
Originally created by @ashm-dev on GitHub (Feb 14, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21411
Description
File handles opened with
open(file_path, "rb")are passed to HTTP requests but never closed. Each request leaks one file descriptor.Locations
1. audio.py (line ~645)
File:
backend/open_webui/routers/audio.pyrequests.postdoes not close file objects passed infiles. If the request fails or the function returns early, the file descriptor leaks.2. pipelines.py (line ~234)
File:
backend/open_webui/routers/pipelines.pySame issue with
aiohttp.FormData.Fix
Simplest fix — use
pathlib.Path.read_bytes(), which opens, reads, and closes the file in one call:No file descriptor leak —
read_bytes()handles open/close internally.@tjbck commented on GitHub (Feb 15, 2026):
Addressed in dev!