You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix: Bound local WebSocket connections and HTTP Upgrade timeout #421
The default local WebSocket server accepts TCP connections and immediately spawns a task for each connection before the HTTP Upgrade is completed.
The current implementation has two resource-management problems:
There is no application-level limit on the number of local WebSocket connection tasks.
accept_hdr_async has no timeout, so a client that opens a TCP connection but never completes the HTTP Upgrade can keep a task and socket open indefinitely.
Impact
A local client can consume daemon tasks and socket file descripters by:
Opening mant TCP connections without sending HTTP headers.
Sending and incomplete HTTP Upgrade request.
Completing the Upgrade and keeping the connection open without sending the application handshake.
Expected behavior
The local WebSocket server should:
Enforce a bounded number of active connections.
Reject or close new connections when the connection is at limit.
Apply a timeout to HTTP Upgrade phase.
Release the connection slot when the connection closes or the Upgrade times out.
Reproduction
Start the local daemon.
Open a TCP connection to the WebSocket Port.
Do not send any data, or only send and incomplete HTTP Upgrade request.
Observe that the connection remains open beyond the existing application handshake timeout.
Notes
This issue covers the default local WebSocket implementation only.
Activity