-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Websockets cause segfault when closing from server side #446
Comments
v1.0+3 fwiw |
I can confirm the issue is occurring on Master as well, Will investigate further. I should note you had an extra |
Thanks. Sorry for the stray |
Don't worry about it :) |
Interestingly this issue seems to occur whenever the server attempts to close the websocket connection.. A temporary solution would be to close it from the client instead. |
In a more elaborate program I got a segfault when closing the websocket server-side as well, but with a different backtrace. In that case, the method |
When I ran the example with GDB, the stack trace showed that somehow it was attempting to read from the websocket after deleting it... |
If I understand this correctly a read after delete could also cause |
I believe the actual problem is that read attempts to reference the socket_adaptor, which gets deleted along with the websocket connection. This is most likely the cause of the segfault. |
I get the additional read after closing from the client-side too. I connected
So
This does not segfault, though obviously |
Why it even gets this far in this case, I have no idea. It should trigger the segfault caused by using the already deleted socket_adaptor as well? |
|
I can avoid the segfault when closing server-side by changing the |
@The-EDev I think I found the issue. |
This fixes the segfault when closing server-side. I still get an additional read with error-handler being called, when closing client-side. Investigating further, I found that the server is receiving a close, then according to https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.1 sends back the close. It then does |
When I call crow::websocket::connection::close() server side, my application segfaults. Minimal example showing the problem I have:
index.html used:
So the frontend opens a websocket and when the disconnect-button is clicked, the server should close it. I guess, I am doing something wrong, besides multiple connections cannot be handled in this example :) The onclose()-handler is called, I get reason logged. And then segfault.
The text was updated successfully, but these errors were encountered: