Skip to content

fix(web_socket): bound the TLS handshake of a wss connection by process_timeout - #741

Merged
route merged 1 commit into
mainfrom
fix/tls-handshake-timeout
Nov 27, 2026
Merged

route merged 1 commit into
mainfrom
fix/tls-handshake-timeout

Conversation

@route

@route route commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

:process_timeout bounds connecting to a running browser at :url or :ws_url, and raises ConnectTimeoutError when it runs out. For a wss:// URL it only covered the TCP connect. The TLS handshake after it was a blocking SSLSocket#connect with no limit, so a host that accepted the connection and never answered TLS, such as a stuck proxy or load balancer in front of a remote Chrome, hung Browser.new forever. :timeout didn't help either, since no CDP command had been sent yet.

The handshake now runs with connect_nonblock, waiting with wait_readable or wait_writable for what's left of the same deadline as the TCP connect. When the deadline runs out it raises ConnectTimeoutError with the same message as a TCP connect timeout, and closes the socket. With the default :process_timeout of 10 seconds a stuck handshake now fails after 10 seconds. process_timeout: nil still waits indefinitely.

Which connections use TLS (port 443 or the wss scheme) and how the TLS context is set up are unchanged.

…ss_timeout

process_timeout bounded the TCP connect but not the TLS handshake after it, so a wss:// host that accepted the
connection and never answered TLS hung Browser.new forever. The handshake runs with connect_nonblock under the same
deadline as the TCP connect now and raises ConnectTimeoutError when it runs out, closing the socket.
@route
route force-pushed the fix/tls-handshake-timeout branch from dc8ecfa to 5d3fcf4 Compare November 27, 2026 19:00
@route
route merged commit 36cf0d9 into main Nov 27, 2026
7 checks passed
@route
route deleted the fix/tls-handshake-timeout branch November 27, 2026 19:16
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.

1 participant