Closed martin-mucha closed 6 years ago
Hello @mmucha-redhat,
could you please use the template for your bug report.
Right now I do not understand what you are doing and what you are expecting.
Greetings marci4
There isn't an error. I was just a suggesting to close all connections before closing server in your demo ChatServer implementation, since otherwise it does not close port immediately on linux.
Sorry to post on your closed issue!
This is not how the closing handshake works for the RFC 6455. A connection is closed when the endpoints receives a close frame. The websocket server is sending these frames during stop(), which he has to receive to close the connection!
Greetings marci4
Sorry about this report; examining stop method it indeed closes all connections. However, on my env, it does not close port if any connection is opened before calling stop. And calling Websocket.stop(going_away) myself before closing WebSocketServer 'seemed' to remove this issue.
I might be wrong on that, I saw issue just a few times. I'll try to reproduce again, and if I do, I'll post proper bug report. With this one, I just thought there is error in example, which there isn't.
I wrote prototype app, 99% the same. When I start server, and connect to it with client and then terminate server via stop() method, client connection (probably) will still hold respective port open (netstat -anp still reports it, but without associated process). Only after some time (tens of seconds) it's released.
Looping over opened connections and closing them before calling stop() fixes this issue, and immediately after server stop port is not used as expected.
I believe, it what I'm saying is correct, that this should be presented in example.
Thanks.