mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #23953] issue: DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVAL must be set to 0 for open webui to start up after 0.9.0 #58791
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 @Classic298 on GitHub (Apr 21, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23953
Bug Report
Describe the bug
get_current_userinbackend/open_webui/utils/auth.pycrashes withTypeError: a coroutine was expected, got Noneon every authenticated request after the first one within theDATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVALwindow. As a side effect, theexceptblock deletes the user's auth cookies, silently logging them out.Root Cause
Users.update_last_active_by_id(inbackend/open_webui/models/users.py) is anasyncmethod decorated with@throttle(DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVAL).The
throttledecorator inbackend/open_webui/utils/misc.pyis a synchronous wrapper. When a call is throttled, it returnsNoneinstead of invoking the wrapped coroutine function. The caller inauth.pythen does:Since the throttled call returns
None(not a coroutine),asyncio.create_task(None)raisesTypeError: a coroutine was expected, got None. The surroundingtry/exceptcatches this, raises further, and the outer handler deletestoken,oauth_id_token, andoauth_session_idcookies — effectively logging the user out.Steps to Reproduce
DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVALto any non-zero value (default300).Expected Behavior
Throttled calls to the
last_active_atupdate should be silently skipped without raising, and users should remain logged in.Actual Behavior
Workaround
Set
DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVAL=0in the environment. This disables throttling (the decorator'snow - last_call < 0check is always false), so the async function is always invoked and always returns a coroutine. Downside: a DBUPDATEon every authenticated request.Suggested Fix
Make the
throttledecorator async-aware so it can wrap coroutine functions correctly — e.g. detectasyncio.iscoroutinefunction(func)and return either a no-op coroutine or anasync defwrapper that awaits the real call. Alternatively, guard the call site inauth.py:but fixing the decorator is the cleaner solution since the same pattern could break elsewhere.
Relevant Files
backend/open_webui/utils/auth.py(line ~386)backend/open_webui/models/users.py(line ~612,update_last_active_by_id)backend/open_webui/utils/misc.py(line ~833,throttle)@tjbck commented on GitHub (Apr 24, 2026):
Likely addressed in dev.