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
WebSocket: backend request left open when the client leaves before the upgrade completes #155
The client and backend sockets of a proxied WebSocket are only joined in ReverseProxy.Proxy#sendResponse once the
backend answers 101. Nothing watches the client connection before that, so a client that goes away during the
upgrade leaves the request to the backend open:
Backend has not answered yet: the backend connection stays open for as long as the backend does not answer
(indefinitely for a backend that never answers).
Backend answers 101 after the client left:proxiedRequest().toNetSocket() fails, the failure branch prints Handle this case and a stack trace to System.err, and the backend socket is never closed.
Client already gone when the origin is resolved (e.g. an OriginRequestProvider doing an async lookup): the
upgrade is still sent to the backend.
Proxied HTTP requests do not have this problem: ProxiedRequest#sendRequest resets the backend request from the
client response's exception handler. The WebSocket branch in ReverseProxy.Proxy#sendRequest calls request.connect() directly and does not set it.
Steps to reproduce
Proxy to a backend that reads the upgrade request and never answers.
Send a WebSocket upgrade through the proxy, then close the client connection.
The backend connection is never closed.
Do you have a reproducer?
Yes, two tests in WebSocketTest in the linked PR; both fail on main (the first by timing out, the second with the
upgrade reaching the backend).
Activity
tsegismont commentedon Oct 20, 2026
Fixed by #162