You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lib is great. Although there were some issues encountered during use
When the server is abnormally shut down, the client did not receive the close event. It seems that the FD_CLOSE event should be taken into account in WSAWaitForMultipleEvents in IXNetSystem::poll.
It's probable that there is a missing wakeUpFromPoll() call from WebSocketTransport::close() to unlock the WebSocket::stop() function which is waiting for a _thread.join() (this thread is running WebSocket::run() which calls WebSocketTransport::poll() that can be waken up only if wakeUpFromPoll() is called again):
diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp
index ec25465..8049fb6 100644
--- a/ixwebsocket/IXWebSocketTransport.cpp+++ b/ixwebsocket/IXWebSocketTransport.cpp@@ -1174,7 +1174,10 @@ namespace ix
{
_requestInitCancellation = true;
- if (_readyState == ReadyState::CLOSING || _readyState == ReadyState::CLOSED) return;+ if (_readyState == ReadyState::CLOSING || _readyState == ReadyState::CLOSED) {+ wakeUpFromPoll(SelectInterrupt::kSendRequest);+ return;+ }
if (closeWireSize == 0)
{
Activity
bsergean commentedon Jul 1, 2023
Thanks for the good words, it's possible there are some holes in the IXNetSystem::poll.
If you want to submit a PR we can try to evaluate it and merge it.
I code on macOS and Linux, so I'm not the best person to fix advanced windows problem sadly.
dacap commentedon Aug 22, 2023
It's probable that there is a missing
wakeUpFromPoll()call fromWebSocketTransport::close()to unlock theWebSocket::stop()function which is waiting for a_thread.join()(this thread is runningWebSocket::run()which callsWebSocketTransport::poll()that can be waken up only ifwakeUpFromPoll()is called again):bsergean commentedon Aug 23, 2023
@dacap If you make a PR for this change we can give it a try on CI.
Fix hanging of WebSocket::stop() waiting for its thread to join
Fix hanging of WebSocket::stop() waiting for its thread to join
Fix hanging of WebSocket::stop() waiting for its thread to join
Fix hanging of WebSocket::stop() waiting for its thread to join (#481)
Longwater1234 commentedon Jul 9, 2024
This problem still persists even with latest version. Only on Windows. On MacOS it alright.
bsergean commentedon May 14, 2025
Might be fixed with #548