Skip to content

[bug] Ask Sourcebot chat runs into bottleneck client-side, causing webpage crash #626

@andy-lz

Description

@andy-lz

Describe the bug

Hello,

I notice that when using Ask Sourcebot on my self-hosted instance, I see the chat rendering getting slower as the response grows in size, to the point where browser becomes unresponsive. In the worst case, the browser crashed with a STATUS_ACCESS_VIOLATION error.

I’m guessing the culprit is in the ChatThread useChat/messagePairs hook, which seems to re-render the component (and all message pairs) on every chunk received. Maybe some memoization would help? And/or batching some of the heavy rendering work.

https://github.com/sourcebot-dev/sourcebot/blob/main/packages/web/src/features/chat/components/chatThread/chatThread.tsx#L313

To reproduce

self-hosted instance with an internal LLM

Sourcebot deployment information

Sourcebot version (e.g. v3.0.1):
running on sourcebot:main.

Additional information

No response

Metadata

Metadata

Labels

ask_sbIssue related to Ask Sourcebot. https://docs.sourcebot.dev/docs/features/ask/overviewbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions