Skip to content

Conversation

@vsonti23
Copy link

@vsonti23 vsonti23 commented Jan 11, 2026

Race condition causing sst dev --mode=basic to hang on startup

In basic mode, the UI client was attempting to connect to the HTTP server before it was ready to accept connections, resulting in "connection refused" errors and causing the application to hang
indefinitely.

Root cause: server.Start() runs in a goroutine while CmdUI() immediately tries to connect, creating a race between server initialization and client connection.

Solution:

• Added a Ready channel to the Server struct that signals when the server is listening
• Modified basic mode to wait on <-server.Ready before starting the UI
• Close the Ready channel after net.Listen() succeeds (and on error to prevent infinite hangs)

fixes #3990

@vsonti23 vsonti23 changed the title Fix race condition in basic mode server startup fix: race condition in basic mode server startup Jan 11, 2026
@vimtor vimtor self-assigned this Jan 18, 2026
Copy link
Collaborator

@vimtor vimtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your contribution @vsonti23

proof of it working Image Image Image

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.

sst dev --mode=basic does not work

2 participants