Bug #7036
closedMisleading websocket connect failure message under some conditions
0%
Description
With github wt 4.0.5-31-ga05a7c5d, it is possible to receive a misleading websocket connect failure. For instance, if the server is restarted, connected clients will try to re-establish the websocket connections and log an error:
Wt: WebSocket request refused: Origin 'http://localhost:8080' not allowed (trusted origin is 'ws://')
The actual error in this case is that the wtd no longer matches the one expected by the server.
A patch (lightly tested) is attached for your review. The patch logs more information on websocket connection failures. It also kills the failed session more quickly, which is intended to reduce resource consumption.
Files
Updated by Roel Standaert almost 5 years ago
Maybe it should kill the session if it's brand new, but I don't think an origin mismatch in general should ever cause a session to be killed.
Apart from that, the logging could be improved indeed.
Updated by Bruce Toll almost 5 years ago
Thanks for catching the kill issue. I was focused on the server restart situation which results in mismatched session ids and should have limited the kill to that case. I suspect that a mismatched sessionId_ (where logged) implies a new session, but it would be conservative to remove the kill entirely. If you'd like me to update the patch either way, just let me know.
Updated by Roel Standaert almost 5 years ago
- Status changed from New to Resolved
I decided to handle it in WebController, and not create a WebSession in the first place if it is a WebSocket request coming in.
Updated by Bruce Toll almost 5 years ago
Thanks, Roel. That's a better approach and far more informative message.
Updated by Roel Standaert over 4 years ago
- Status changed from Resolved to Closed