-
Notifications
You must be signed in to change notification settings - Fork 160
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
Windows: Basic echo fails to connect on 5.0.4 #103
Comments
I have a feeling it relates to using poll instead of select now to react on network.
I need to repair CI for Windows. I still don't have access to a Windows box easily (I periodically download a Windows 10 VM). Last time I tried with travis I had issues, I will try to setup AppVeyor support when I get a chance.
If you want to mess around, this is what I would do.
add a new function mimicking poll using select under the hood, in IXNetSystem.cpp
… On Aug 21, 2019, at 11:08 AM, Olivia Zoe ***@***.***> wrote:
5.0.4 and Windows don't appear to get along. All my unit tests are failing <https://ci.appveyor.com/project/LunarWatcher/conan-ixwebsocket> on 5.0.4, and attempting to compile it locally (git clone https://github.com/lunarwatcher/conan-ixwebsocket && cd conan-ixwebsocket && conan create . IXWebSocket/LunarWatcher) successfully compiles it, but prints errors:
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error
These aren't visible in the CI builds (I have no idea why)
For reproducibility, the code:
#include <iostream>
#include <ixwebsocket/IXWebSocket.h>
#include <string>
#include <vector>
#include <chrono>
#include <thread>
#include <ixwebsocket/IXNetSystem.h>
class SocketWrapper {
private:
ix::WebSocket webSocket;
std::vector<std::string> receivedMessages;
public:
SocketWrapper() {
webSocket.setUrl(std::string("ws://echo.websocket.org"));
webSocket.setOnMessageCallback(
[this](const ix::WebSocketMessagePtr& message) {
if (message->type == ix::WebSocketMessageType::Open) {
std::cout << "Connected\n";
//webSocket.send(std::string("Congrats, your local version of IXWebSocket works!"));
} else if (message->type == ix::WebSocketMessageType::Close) {
std::cout << "Closing socket...\n";
} else if (message->type == ix::WebSocketMessageType::Message) {
std::cout << "Message received from server: " << message->str << std::endl;
receivedMessages.push_back(message->str);
} else if (message->type == ix::WebSocketMessageType::Error) {
std::cout << "ERROR: " << message->errorInfo.reason << std::endl;
}
});
webSocket.start();
}
bool hasReceived() { return receivedMessages.size() > 0; }
void close() { this->webSocket.close(); }
bool ready() {
return this->webSocket.getReadyState() == ix::ReadyState::Open;
}
void send(std::string message) { this->webSocket.send(message); }
};
int main() {
std::cout << "Starting socket..." << std::endl;
ix::initNetSystem(); // required for Windows
SocketWrapper socketWrapper;
int counter = 0;
while(true) {
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
counter++;
if (socketWrapper.hasReceived()) {
break;
} else if (counter >= 5) {
socketWrapper.close();
ix::uninitNetSystem();
throw "No response for 10 seconds: assuming failure";
}
if (socketWrapper.ready()) {
socketWrapper.send("Congrats, your local version of IXWebSocket works!");
}
}
std::cout << "Message received! Closing socket." << std::endl;
socketWrapper.close();
std::cout << "Socket disconnected." << std::endl;
ix::uninitNetSystem(); // required for Windows.
}
For context, all the builds on 5.0.4 pass on Linux and Mac <https://travis-ci.org/LunarWatcher/conan-IXWebSocket/builds/574497963>. The code is also identical in the 5.0.0 build and 5.0.4 build. I'm pretty sure this is triggered by v5.0.4 (or one of the versions in between that didn't work on Windows), but it could of course be my fault, but when it works on the other two operating systems and I have ix::initNetSystem(), I can't find anything else that could trigger it
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#103?email_source=notifications&email_token=AC2O6UKHCWS3N6BHZYNATXLQFWAAXA5CNFSM4IOLRE72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGSXFWA>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AC2O6UPLZ5AEEOCSBVCV6ODQFWAAXANCNFSM4IOLRE7Q>.
|
Double checking:
version = "5.0.0"
I found this in one of the conan files (the one from the master branch), you're using 5.0.4 right ?
… On Aug 21, 2019, at 11:39 AM, Benjamin Sergeant ***@***.***> wrote:
I have a feeling it relates to using poll instead of select now to react on network.
I need to repair CI for Windows. I still don't have access to a Windows box easily (I periodically download a Windows 10 VM). Last time I tried with travis I had issues, I will try to setup AppVeyor support when I get a chance.
If you want to mess around, this is what I would do.
add a new function mimicking poll using select under the hood, in IXNetSystem.cpp
(see https://github.com/mpv-player/mpv/pull/5203/files <https://github.com/mpv-player/mpv/pull/5203/files>)
> On Aug 21, 2019, at 11:08 AM, Olivia Zoe ***@***.*** ***@***.***>> wrote:
>
> 5.0.4 and Windows don't appear to get along. All my unit tests are failing <https://ci.appveyor.com/project/LunarWatcher/conan-ixwebsocket> on 5.0.4, and attempting to compile it locally (git clone https://github.com/lunarwatcher/conan-ixwebsocket <https://github.com/lunarwatcher/conan-ixwebsocket> && cd conan-ixwebsocket && conan create . IXWebSocket/LunarWatcher) successfully compiles it, but prints errors:
>
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> ERROR: Unable to connect to echo.websocket.org <http://echo.websocket.org/> on port 80, error: Connect error: No error
> These aren't visible in the CI builds (I have no idea why)
>
> For reproducibility, the code:
>
> #include <iostream>
> #include <ixwebsocket/IXWebSocket.h>
> #include <string>
> #include <vector>
> #include <chrono>
> #include <thread>
> #include <ixwebsocket/IXNetSystem.h>
>
> class SocketWrapper {
> private:
> ix::WebSocket webSocket;
> std::vector<std::string> receivedMessages;
> public:
> SocketWrapper() {
> webSocket.setUrl(std::string("ws://echo.websocket.org <ws://echo.websocket.org/>"));
> webSocket.setOnMessageCallback(
> [this](const ix::WebSocketMessagePtr& message) {
> if (message->type == ix::WebSocketMessageType::Open) {
> std::cout << "Connected\n";
> //webSocket.send(std::string("Congrats, your local version of IXWebSocket works!"));
> } else if (message->type == ix::WebSocketMessageType::Close) {
> std::cout << "Closing socket...\n";
> } else if (message->type == ix::WebSocketMessageType::Message) {
> std::cout << "Message received from server: " << message->str << std::endl;
> receivedMessages.push_back(message->str);
> } else if (message->type == ix::WebSocketMessageType::Error) {
> std::cout << "ERROR: " << message->errorInfo.reason << std::endl;
> }
> });
> webSocket.start();
>
> }
>
> bool hasReceived() { return receivedMessages.size() > 0; }
> void close() { this->webSocket.close(); }
> bool ready() {
> return this->webSocket.getReadyState() == ix::ReadyState::Open;
> }
> void send(std::string message) { this->webSocket.send(message); }
> };
>
> int main() {
> std::cout << "Starting socket..." << std::endl;
> ix::initNetSystem(); // required for Windows
> SocketWrapper socketWrapper;
> int counter = 0;
> while(true) {
> std::this_thread::sleep_for(std::chrono::milliseconds(2000));
> counter++;
> if (socketWrapper.hasReceived()) {
> break;
> } else if (counter >= 5) {
> socketWrapper.close();
> ix::uninitNetSystem();
> throw "No response for 10 seconds: assuming failure";
> }
>
> if (socketWrapper.ready()) {
> socketWrapper.send("Congrats, your local version of IXWebSocket works!");
> }
> }
> std::cout << "Message received! Closing socket." << std::endl;
> socketWrapper.close();
> std::cout << "Socket disconnected." << std::endl;
>
> ix::uninitNetSystem(); // required for Windows.
> }
> For context, all the builds on 5.0.4 pass on Linux and Mac <https://travis-ci.org/LunarWatcher/conan-IXWebSocket/builds/574497963>. The code is also identical in the 5.0.0 build and 5.0.4 build. I'm pretty sure this is triggered by v5.0.4 (or one of the versions in between that didn't work on Windows), but it could of course be my fault, but when it works on the other two operating systems and I have ix::initNetSystem(), I can't find anything else that could trigger it
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub <#103?email_source=notifications&email_token=AC2O6UKHCWS3N6BHZYNATXLQFWAAXA5CNFSM4IOLRE72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGSXFWA>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AC2O6UPLZ5AEEOCSBVCV6ODQFWAAXANCNFSM4IOLRE7Q>.
>
|
Whoops, my bad. I forgot to mention |
I just made a v5.0.5 with the potential fix I was talking about. Can you give it a try ? |
See 193da82 |
Great, thanks! I've pushed the v5.0.5 branch. I'll update this reply when I start getting a status on them. It might take a few minutes before the first builds start succeeding. |
This triggered a compile-time error when linking:
I also see why - the poll function isn't defined in the |
Oops ... I just made v5.0.6 to fix that (87a45a2)
… On Aug 22, 2019, at 11:01 AM, Olivia Zoe ***@***.***> wrote:
This triggered a compile-time error when linking:
ixwebsocket.lib(IXSocket.obj) : error LNK2019: unresolved external symbol "int __cdecl poll(struct pollfd *,unsigned long,int)" (?poll@@YAHPEAUpollfd@@***@***.***) referenced in function "public: static enum ix::PollResultType __cdecl ix::Sock
et::poll(bool,int,int,class std::shared_ptr<class ix::SelectInterrupt>)" ***@***.***@ix@@***@***.***@***@***.***@ix@@@std@@@z) [D:\programming\projects\cpp\conan-IXWebSocket\test_package\build\ecbfb49
a4e2ea8618319be5f9e02c8e0621391fb\tests.vcxproj]
Hint on symbols that are defined and could potentially match:
"public: static enum ix::PollResultType __cdecl ix::Socket::poll(bool,int,int,class std::shared_ptr<class ix::SelectInterrupt>)" ***@***.***@ix@@***@***.***@***@***.***@ix@@@std@@@z)
"public: enum ix::WebSocketTransport::PollResult __cdecl ix::WebSocketTransport::poll(void)" ***@***.***@ix@@***@***.***@xz)
"int __cdecl ix::poll(struct pollfd *,unsigned long,int)" ***@***.***@@YAHPEAUpollfd@@***@***.***)
I also see why - the poll function isn't defined in the ix namespace, but the declaration in the cpp file is.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#103?email_source=notifications&email_token=AC2O6UPIIGL2SVYMQRQI4Q3QF3H6VA5CNFSM4IOLRE72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD45457Q#issuecomment-524013310>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AC2O6ULFR5BU4QS2Q5ZUKT3QF3H6VANCNFSM4IOLRE7Q>.
|
It's a bit gross to redefine my global poll btw, in the future I might have a named wrapper for it. But right now I'm just interested in seeing if this fixes your problem. |
Yep, that did the trick. It builds locally, and the CI build is looking good so far (built x86 and some of the x86_64 configurations on one of the MSVC versions). It prints output from the tests when expected to as well. Thanks! These are also being pushed to conan as the soon as the CI builds finish. |
Excellent. Thanks for reporting the problem !! |
Some test started to fail on Windows in the 5.0 branch. ``` ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ``` We figured it out and fixed it. This issue has more details. machinezone/IXWebSocket#103
* [ixwebsocket] update to 5.0.6 to fix Windows problem Some test started to fail on Windows in the 5.0 branch. ``` ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ERROR: Unable to connect to echo.websocket.org on port 80, error: Connect error: No error ``` We figured it out and fixed it. This issue has more details. machinezone/IXWebSocket#103 * ixwebsocket: update to 6.1.0
5.0.4 and Windows don't appear to get along. All my unit tests are failing on 5.0.4, and attempting to compile it locally (
git clone https://github.com/lunarwatcher/conan-ixwebsocket && cd conan-ixwebsocket && conan create . IXWebSocket/LunarWatcher
) successfully compiles it, but prints errors:These aren't visible in the CI builds (I have no idea why)
For reproducibility, the code:
For context, all the builds on 5.0.4 pass on Linux and Mac. The code is also identical in the 5.0.0 build and 5.0.4 build. I'm pretty sure this is triggered by v5.0.4 (or one of the versions in between that didn't work on Windows), but it could of course be my fault, but when it works on the other two operating systems and I have
ix::initNetSystem()
, I can't find anything else that could trigger itThe text was updated successfully, but these errors were encountered: