We reproduced unexpected behavior in a small Cloud Run test service:
-
A WebSocket upgrade arrives with a malformed URL. Our Node.js service rejects it using
socket.destroy()without sending an HTTP response. -
Cloud Run reports the failed upgrade as HTTP 500 and subsequently stops routing all new requests, including ordinary API requests, to that instance.
-
The application continues running normally, existing WebSockets remain usable, and the liveness probe stays healthy.
-
The instance appears to remain in a draining state for the configured request timeout—30 minutes in our test—before replacement.
Repeating this request across instances can effectively remove the entire fleet from serving new requests for 30 minutes.
We could not find a log entry or metric indicating that an instance had been excluded from routing or had started draining. The failed request is visible; the resulting instance state is not.
Two controls did not reproduce this behavior:
-
Rejecting the WebSocket upgrade with a complete HTTP error response before closing the connection.
-
Calling
socket.destroy()on an ordinary HTTP request.
Is this expected Cloud Run behavior, or a bug? Specifically:
-
Why does one abruptly rejected WebSocket upgrade exclude a healthy instance from handling subsequent requests?
-
Why does replacement wait for the request timeout while liveness remains healthy?
-
Which logs or metrics expose this routing exclusion or drain state?
The rejection code has existed for a long time; we had not observed this behavior previously. Has this behavior changed recently?