Skip to content

bug: Potential main-thread deadlock in EmbeddedChatApi.ts when typingHandlerLock remains set #1354

Description

@jhalak101205-cpu

Bug Description

When running EmbeddedChat and receiving typing status notifications over the DDP WebSocket connection, the browser tab completely freezes and becomes unresponsive (causing a white screen or canvas freeze in Storybook / React applications).


Root Cause Analysis

Inside packages/api/src/EmbeddedChatApi.ts, the function handleTypingEvent contains a synchronous busy-wait loop:

// packages/api/src/EmbeddedChatApi.ts (Line 456)
setTimeout(() => {
  typingHandlerLock = 0;
}, 2000);

while (typingHandlerLock) {} // <--- Critical Bug
typingHandlerLock = 1;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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