-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Live stream using ZMQ doesn't work on Mac #34031
Comments
From reviewing the source code, it seems that it should work on macOS. However, here are a few things to check and troubleshoot:
If none of these steps resolve the issue, please let me know, and we can continue troubleshooting. |
|
If there are no firewall or zmq version issues, we can start by adding some debug print statements in int ZMQSubSocket::connect(Context *context, std::string endpoint, std::string address, bool conflate, bool check_endpoint){
sock = zmq_socket(context->getRawContext(), ZMQ_SUB);
if (sock == NULL){
return -1;
}
zmq_setsockopt(sock, ZMQ_SUBSCRIBE, "", 0);
if (conflate){
int arg = 1;
zmq_setsockopt(sock, ZMQ_CONFLATE, &arg, sizeof(int));
}
int reconnect_ivl = 500;
zmq_setsockopt(sock, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl, sizeof(reconnect_ivl));
full_endpoint = "tcp://" + address + ":";
if (check_endpoint){
full_endpoint += std::to_string(get_port(endpoint));
} else {
full_endpoint += endpoint;
}
printf("Attempting to connect to zmq endpoint: %s\n", full_endpoint.c_str());
return zmq_connect(sock, full_endpoint.c_str());
}
Message * ZMQSubSocket::receive(bool non_blocking){
zmq_msg_t msg;
assert(zmq_msg_init(&msg) == 0);
int flags = non_blocking ? ZMQ_DONTWAIT : 0;
int rc = zmq_msg_recv(&msg, sock, flags);
Message *r = NULL;
if (rc >= 0) {
// Make a copy to ensure the data is aligned
r = new ZMQMessage;
r->init((char *)zmq_msg_data(&msg), zmq_msg_size(&msg));
} else {
int err = zmq_errno();
if (non_blocking && err == EAGAIN) {
printf("Non-blocking receive: No message available\n");
} else {
printf("Error receiving message: %d, %s\n", err, zmq_strerror(err));
}
}
zmq_msg_close(&msg);
return r;
} Once you've added these debug prints, compile Cabana using This will help you track connection and message reception details. Let me know what output you get, and we can continue troubleshooting. |
On 3X..
On macOS, add debug, scons and run..
|
Thanks for helping with the troubleshooting! It looks like the issue is caused by a port mismatch between the Mac and the device:
It seems the I'll submit a PR to fix this. |
added this..
suceeded..
but..
|
This might be caused by the
Then, run the bridge, and run Cabana on your Mac to see if it receives the messages. |
@deanlee
I'm wondering, if that's an unpredictable behaviour, perhaps when running ./bridge on the device, should it advertise the port it's listening on? Then let cabana also specify ip:port combination to connect. If both parties disclosure the full address they're using to communicate we would spot the issue way faster. |
Describe the bug
I go in my C3X and run:
Then I open cabana and pick ZMQ as a stream method and then I point to my C3X's IP. It hangs on the screen below:
The screenshot is not really mine. It's from a user on Discord but the issue is the same.
I know Mac isn't officially supported but wanted to flag this anyway.
Provide a route where the issue occurs
625ccd09daec723c/00000055--3b455c2343/0
openpilot version
0.9.7
Additional info
I have an Ubuntu 20.04 on the same machine(dual boot) and it works fine from there. Signaling it's not a network issue or something with C3X.
The text was updated successfully, but these errors were encountered: