-
Notifications
You must be signed in to change notification settings - Fork 40
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
UI frontend client fails to connect to the server on FreeBSD #12
Comments
It seems to me that the client fails to properly wait for the connection event to complete and just terminates the connection. |
Will have to investigate this in a VM; I am using websocketpp for communication between client and server, so any bug on freebsd is likely to be present already upstream. |
Yes, please investigate. Here is my port submission: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210476 This might be a FreeBSD-only bug, because it uses kqueue/kevent only on FreeBSD. One thing to try is to update websocketpp to the latest version - this 'might' help. |
I tried -DBOOST_ASIO_DISABLE_KQUEUE, but the problem is still there with selects instead of kevents. I also tried replacing websocketpp-0.6.0 with websocketpp-0.7.0, and this also didn't solve the problem. EINPROGRESS condition from connect(2) in websocketpp isn't processed properly. |
@kpeeters Are you able to provide a small, standalone example code for cadabra2 client/server communication that is easier to look at? |
I have nothing simpler than the code in the If you have pinned this down to EINPROGRESS not being handled properly by websocketpp, I would think that by far the best (and least time-consuming) resolution is to raise that directly with the author of websocketpp. |
Is there any chance it would be possible to get a debug level output from websocketpp's built in logging system when this happens? |
Yes. Are there instructions how to do this? |
General logging reference is here for context: https://docs.websocketpp.org/reference_8logging.html The debug logging level is a performance hit so it isn't compiled into the default configs. The likely changes would be: https://github.com/kpeeters/cadabra2/blob/master/client_server/Server.hh#L7 https://github.com/kpeeters/cadabra2/blob/master/client_server/Server.hh#L64 https://github.com/kpeeters/cadabra2/blob/master/client_server/Server.cc#L547-L548 By default output will go to standard out. If that is a problem for this app it can also be redirected to a file. |
When I changed the lines you suggested, it doesn't cycle any more. Now it complains about uri:
The original behavior was that it cycled:
The patches I applied are:
|
Looks like github ate part of the directions:
is the only additional header needed That said, that change shouldn't have any effect on URI validation. What is the URI in question? Also, is there a document anywhere that details the steps to build/reproduce on a fresh freebsd install? (I see instructions for various Linuxes only). |
It still doesn't cycle with To reproduce on FreeBSD 10.3:
Perform steps 1..3 as root, step 4 as a regular user. Step 3 takes a long time due to dependencies build. You can speed it up by first running |
Invalid URI is ws://127.0.0.1:0 |
Confirming that this quick patch into boost solves the problem. EINPROGRESS mishandling is indeed the cause of the problem.
I am not too familiar with boost. Any idea how EINPROGRESS is supposed to be handled? It's hard to believe that boost has such a bug because it is quite widely used. |
I now have a FreeBSD 11 virtual machine available for testing/experimenting. As I'm a total FreeBSD novice, would you mind jotting down the recommended way of installing all prerequisites for compiling cadabra from github on FreeBSD? I will then have another look at getting this problem sorted. Many thanks! |
Just do this:
Make sure the version in Makefile says 2.0.930, otherwise you need to update ports. Just in case, ports are checked out with Please note that all the above problems were patched and this port works fine now, as far as I can tell anyway. This port actually goes a long way to patch these. It overrides the socket_ops.ipp from boost to process EINPROGRESS properly, and overrides endpoint.hpp from websockets to patch v6->v4. |
The original problem of this bug is caused by the bug in websockets zaphoyd/websocketpp#587 Websockets wrongly assume that v6 to v4 mapping always works, and defined default API methods under this assumption. IMO, there is no need to assume anything about v6/v4 protocols on the websockets level. Users should listen for and connect to the proper or desired protocol versions. So this should be fixed in websockets, and this bug here should be closed. |
Yes, but since I am distributing websockets along with cadabra, I may as well patch it so it works for us. |
Then you should ensure it only uses v4 locally. |
I know you reported this ages ago, but I have just patched the websocketpp inside cadabra (the two 'listen' functions). It's in the feature/kwindows branch for now, will soon go into master. I have tried on OpenBSD and this fix works there. |
I've patched this in the FreeBSD port, so it works now. |
Client keeps restarting the server, every time prints this:
System calls log for each cycle:
The text was updated successfully, but these errors were encountered: