-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling stop() does not properly close all active connections, namely websocket connections. #377
Comments
So i now manually keep track of websocket connections, and before i call stop(), i iterate through all the connections, and call close(). Now it turns out the handler that is dispatched at line 6898 in crow_all.h never gets called. If you do a bit more tracking it goes into boost.asio, at which point I loose track of the stack trace. |
I'll try to look into it if i have time. if you can provide some minimal example where the issue appears it would be great. |
Don't worry. I use a combination of https://github.com/yhirose/cpp-httplib and https://github.com/zaphoyd/websocketpp.git. I also sometimes use https://github.com/civetweb/civetweb though i get hanging issues with the last one. |
So I looked through the code (I know you said not to worry), It seems that
|
This is indeed a problem if you
Calling $ lsof -i :18080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
my-server 23405 jf99 44u IPv4 149122 0t0 TCP localhost:18080->localhost:40806 (CLOSE_WAIT) This is with |
From what I've seen in the code (and I might be totally wrong), the primary issue is that Crow doesn't keep track of connections, (with the exception of HTTP connections in debug mode). And the only solution I can think of is what @pfeatherstone was doing but in crow itself, which is keep track of all active connections and send a close signal right before stopping the server as part of |
As far as I remember there're OS settings which affect the CLOSE_WAIT timeouts e.g. |
Like everything else in boost, it seems boost.asio is more complicated than what it needs to be. |
Fixed problem where GCC < 6 wouldn't compile Crow
Calling stop() does not properly close all active connections, namely websocket connections.
The text was updated successfully, but these errors were encountered: