Skip to content

bug: retry 3 attempts automatically each time you see a 1006 error code#9870

Open
nadr0 wants to merge 9 commits intomainfrom
nadro/gh-9869/websocket-1006
Open

bug: retry 3 attempts automatically each time you see a 1006 error code#9870
nadr0 wants to merge 9 commits intomainfrom
nadro/gh-9869/websocket-1006

Conversation

@nadr0
Copy link
Contributor

@nadr0 nadr0 commented Jan 28, 2026

closes #9869

Issue

When the user is using the engine they could be randomly disconnected when the websocket closes with the event code 1006. A user can get this if the pod they are connected to is redeploying (they get booted), the engine crashes, the engine goes OOM (out of mana).

In the case of the engine redeploying and closing we would want to automatically reconnect them since they are not going to be in an infinite boot loop.

Gotcha: If a user produces a KCL file that crashes the engine and we see 1006, we do not want to always reconnect them automatically forever they would be in a loop that would connect, render, crash from rendering, reconnect etc.. forever in a loop.

After 3 retries on 1006 error we show the manual reconnection modal for them to press manually.

Implementation

  • Detect 1006 error code
  • Reset counter after successful connection
  • Automatically reconnect up to 3 times when seeing this error
  • After we fail to connect 3 times on a 1006 seen we will show the manual reconnection modal

Documentation

https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1

1006

  1006 is a reserved value and MUST NOT be set as a status code in a
  Close control frame by an endpoint.  It is designated for use in
  applications expecting a status code to indicate that the
  connection was closed abnormally, e.g., without sending or
  receiving a Close control frame.

@nadr0 nadr0 requested a review from a team as a code owner January 28, 2026 21:20
@vercel
Copy link

vercel bot commented Jan 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
modeling-app Ready Ready Preview, Comment Jan 28, 2026 10:02pm

Request Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Websocket error code 1006 can be an infinite loop or a remote disconnection

1 participant