Skip to content

Fix connection issue with timeout#452

Merged
avalonche merged 4 commits intomainfrom
msozin/fix-connect-timeout
Dec 4, 2025
Merged

Fix connection issue with timeout#452
avalonche merged 4 commits intomainfrom
msozin/fix-connect-timeout

Conversation

@SozinM
Copy link
Copy Markdown
Collaborator

@SozinM SozinM commented Dec 1, 2025

connect_async does not have any timeouts built in, if there is problems with websocket handshake it will hang.

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 1, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rollup-boost Ignored Ignored Preview Dec 1, 2025 4:49pm

akundaz
akundaz previously approved these changes Dec 1, 2025
@akundaz
Copy link
Copy Markdown
Contributor

akundaz commented Dec 1, 2025

please fix ci issues

Comment on lines +85 to +94
} else {
// connect_and_handle should never return Ok(())
tracing::error!("Builder websocket connection has stopped. Invariant is broken.");
Copy link
Copy Markdown
Contributor

@0x00101010 0x00101010 Dec 1, 2025

Choose a reason for hiding this comment

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

Suggest to remove else break part, and just do

match self.connect_and_handle(&mut backoff, timeout).await {
    Err(err) => { ... },
    Ok(err) => {
        // log error, but allow retry
    },
}

We want it to always retry anyway, no point of keeping the break

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My observation is that from our side, the retry is not happening, it seems to be going into the else break part here somehow, however I cannot exactly pinpoint the problem from the code (they look correct). And it's one of the reasons for this suggestion

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@akundaz akundaz dismissed their stale review December 1, 2025 17:48

test failing

Copy link
Copy Markdown
Collaborator

@avalonche avalonche left a comment

Choose a reason for hiding this comment

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

I think these lines shouldn't be needed as the write will be dropped when Ok(()) is returned

  if let Err(e) = write.close().await {
      tracing::warn!("Failed to close builder ws connection: {}", e);
  }

@avalonche avalonche merged commit e354d9d into main Dec 4, 2025
8 of 9 checks passed
@avalonche avalonche deleted the msozin/fix-connect-timeout branch December 4, 2025 18:23
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Feb 11, 2026
* Add timout to connect_async

* Add test

* fmt

* Review comm
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Feb 13, 2026
* Add timout to connect_async

* Add test

* fmt

* Review comm
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.

4 participants