RocketChat / RocketChat/EmbeddedChat

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

Open
#1,151 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
165
Forks
381
Avg merge
1d 2h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search for handleTypingEvent and the global typingHandlerLock, then reproduce the rapid typing-status update scenario in EmbeddedChat. Trace how the current busy-wait affects the event loop and verify that typing updates no longer freeze rendering, timers, or user interactions during the reported workload.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.