Skip to content

Critical: handleTypingEvent busy-wait blocks main thread and freezes UI during typing updates #1151

@Shreyas2004wagh

Description

@Shreyas2004wagh

Description:

The EmbeddedChat UI can become unresponsive when typing status updates are processed frequently.

The issue is caused by a busy-wait synchronization pattern in handleTypingEvent (while (typingHandlerLock) {} with a global lock). Because JavaScript runs on a single thread, this loop blocks the event loop and prevents UI rendering, timers, and async callbacks from running during the wait period.

As typing events increase, this can freeze chat interactions for noticeable periods and severely degrade usability.

Steps to reproduce:

  1. Open EmbeddedChat and join a room.
  2. Have another user or bot repeatedly toggle typing status (start typing / stop typing) in the same room.
  3. Observe the UI while typing events are being emitted rapidly.

Expected behavior:

Typing status updates should be handled without blocking the main thread, and the chat UI should remain responsive throughout.

Actual behavior:

During frequent typing-status updates, the UI can freeze for up to ~2 seconds or more, and user interactions (typing, clicking, scrolling) become temporarily unresponsive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions