[GH-ISSUE #10888] Chat hangs due to unhandled chat-events event #70670

Closed
opened 2026-05-13 02:42:16 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @krystiancha on GitHub (Feb 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10888

Bug Report

Installation Method

Git clone from main, docker build, docker run.

Environment

  • Open WebUI Version: main

  • Ollama (if applicable): N/A

  • Operating System: Linux

  • Browser (if applicable): Firefox 135.0, Chromium 132.0.6834.83

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs. (N/A)
  • I have included the Docker container logs. (N/A)
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Chat does not freeze when using "direct" API connection.

Actual Behavior:

Chat freezes on first prompt after login when using "direct" API connection. Refreshing the page gets rid of this issue.

Description

The chat-events socket.io event handler is not assigned on login. See this line.

The mentioned line is not run on login because layout's onMount method is ran before the user logs in.
When this method is run localStorage.token is still undefined and so this condition is not satisfied, so $socket?.on('chat-events', chatEventHandler) is never executed.

When the user refreshes the page while being logged in, localStorage.token is truthy so the condition is satisfied, $socket?.on('chat-events', chatEventHandler) is executed and the chat no longer hangs.

Reproduction Details

Steps to Reproduce:

  1. Run Open WebUI.
  2. Add a "direct" API connection for your user (Settings -> Connections).
  3. Log out.
  4. Log back in.
  5. Start a chat with any prompt.
  6. The chat hangs.

Logs and Screenshots

Image

Originally created by @krystiancha on GitHub (Feb 27, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/10888 # Bug Report ## Installation Method Git clone from main, docker build, docker run. ## Environment - **Open WebUI Version:** main - **Ollama (if applicable):** N/A - **Operating System:** Linux - **Browser (if applicable):** Firefox 135.0, Chromium 132.0.6834.83 **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. (N/A) - [ ] I have included the Docker container logs. (N/A) - [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Chat does not freeze when using "direct" API connection. ## Actual Behavior: Chat freezes on first prompt after login when using "direct" API connection. Refreshing the page gets rid of this issue. ## Description The `chat-events` socket.io event handler is not assigned on login. See [this](https://github.com/open-webui/open-webui/blob/e4d6fc65ca554aae93d1ba73d5b72be9c71dd8a6/src/routes/%2Blayout.svelte#L497) line. The mentioned line is not run on login because `layout's` `onMount` method is ran before the user logs in. When this method is run `localStorage.token` is still undefined and so [this](https://github.com/open-webui/open-webui/blob/e4d6fc65ca554aae93d1ba73d5b72be9c71dd8a6/src/routes/%2Blayout.svelte#L486) condition is not satisfied, so `$socket?.on('chat-events', chatEventHandler)` is never executed. When the user refreshes the page while being logged in, `localStorage.token` is truthy so the condition is satisfied, `$socket?.on('chat-events', chatEventHandler)` is executed and the chat no longer hangs. ## Reproduction Details **Steps to Reproduce:** 1. Run Open WebUI. 2. Add a "direct" API connection for your user (Settings -> Connections). 3. Log out. 7. Log back in. 8. Start a chat with any prompt. 9. The chat hangs. ## Logs and Screenshots ![Image](https://github.com/user-attachments/assets/029f11de-45ad-4b1b-bf2b-2816498fb6c2)
Author
Owner

@tjbck commented on GitHub (Mar 4, 2025):

Status: Open.
#10997

<!-- gh-comment-id:2696139317 --> @tjbck commented on GitHub (Mar 4, 2025): Status: Open. #10997
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#70670