mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-08 02:01:07 -05:00
[GH-ISSUE #23473] bug: open-webui serve deadlocks on Windows due to uvicorn workers=1 spawn #106990
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 @yamadanoitou on GitHub (Apr 7, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23473
Check Existing Issues
Installation Method
Pip Install
Open WebUI Version
0.8.12
Ollama Version (if applicable)
No response
Operating System
Windows 11
Browser (if applicable)
No response
Confirmation
README.md.Description
open-webui servehangs indefinitely on Windows (pip install, non-Docker). The last log line is:After that, the process is alive but all threads are in Wait state. No error, no traceback — it just silently deadlocks. This affects every Windows pip-install user.
Root Cause
In
open_webui/__init__.py, theserve()function calls:On Windows, passing
workers=(evenworkers=1) causes uvicorn to use itsMultiprocessmanager, which spawns a child process via Python'smultiprocessing.spawn. The child re-importsopen_webui.main, and the heavy module-level initialization (SQLAlchemy, sentence-transformers, alembic migrations, etc.) deadlocks in the spawned subprocess.On Linux/macOS this is not an issue because
forkis available.Proof
Suggested Fix
In
__init__.py, either:Option A — Pass the app object directly instead of a string (already imported on line 68):
Option B — Omit
workerswhen it equals 1:Environment
Related
#13848 — same symptom (Windows, pip install, hangs on startup), no resolution
Additional Information
Current workaround: bypass
open-webui serveentirely and launch via a Python script that passes the app object directly touvicorn.run().@Classic298 commented on GitHub (Apr 7, 2026):
cannot reproduce on windows. works just fine with 1 uvicorn worker
did you test any of your suggested fixes?
did you confirm this is ACTUALLY the root cause?
I highly doubt it because working fine here
@yamadanoitou commented on GitHub (Apr 7, 2026):
Yes, both fixes were tested and confirmed working on this machine before filing.
Reproduction (hangs)
Fix verification (works)
This starts successfully in ~20 seconds and serves requests. Switching back to
open-webui servereproduces the hang every time.Environment details
uv pip install open-webui)Could you share your environment details? Specifically:
This may be environment-specific — possibly related to how
multiprocessing.spawninteracts with the heavy module-level imports inopen_webui.mainon certain configurations.Related: #13848 reports the exact same symptom (Windows, pip install, hangs on startup after
install_frontmatter_requirements).@Classic298 commented on GitHub (Apr 7, 2026):
Pip install
Python 3.12
Uvicorn latest i just updated yesterday
Windows 11
I can't reproduce
@yamadanoitou commented on GitHub (Apr 7, 2026):
On my end, I'm using Python 3.11.9, while you're on 3.12. I double-checked the uvicorn source code and realized that if workers=1, it doesn't use multiprocessing, so my initial analysis might have been off. My bad.
However, I can reproduce the bug here 100% of the time. Running open-webui serve causes it to hang, but passing the app object directly to uvicorn gets it running in about 20 seconds. It’s consistent every time.
The version gap between Python 3.11 and 3.12 might be the culprit. I'll try testing it on 3.12 on my side as well.
@yamadanoitou commented on GitHub (Apr 7, 2026):
I ran the tests, and you were right—my apologies.
I tried open-webui serve on the same machine with the same settings using Python 3.12, and it launched without any issues. However, it consistently hangs on Python 3.11.9.
Here are the results:
Python 3.11.9 + open-webui serve: Hangs (100% reproducible)
Python 3.12.10 + open-webui serve: Launches normally
Python 3.11.9 + uvicorn.run(app_object): Launches normally (Workaround)
My initial analysis regarding the uvicorn workers parameter was incorrect. It seems like something related to the asyncio/event loop in Python 3.11 is causing issues on Windows.
Since the pyproject.toml specifies requires-python = ">=3.11", other 3.11 users might be affected by this. It would be great if we could either bump the minimum version to 3.12 or find a proper workaround for this specific combination.
@Classic298 commented on GitHub (Apr 7, 2026):
It would be more interesting why it works on .12 and not on .11 - if it's not the worker numbers then what is it