-
Notifications
You must be signed in to change notification settings - Fork 9k
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
bridge: implement MSGQ to ZMQ bridge with subscriber-based publishing #32862
Conversation
Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:
|
39328a2
to
58d6a7b
Compare
if (errno == EINTR) { | ||
// Due to frequent EINTR signals from msgq, introduce a brief delay (200 ms) | ||
// to reduce CPU usage during retry attempts. | ||
util::sleep_for(200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add a sleep here to reduce CPU usage while polling.
the MSGQ uses SIGUSR1 for notification between publishers and subscribers, resulting in extremely frequent EINTR signals. This interrupts the poll function frequently, leading to a busy retry loop. This can increase CPU usage from an expected 0% to around 4% during the polling period while waiting for subscribers to connect. Other interrupt-driven modules like camerad, sensorsd may face similar issues.
There's also a bug related to the SIGUSR1 signal: even after the subscriber disconnects, msgq's publisher keeps sending signals to the closed subscriber process.
commaai/msgq#617 is a solution. However, it still needs more testing to confirm its reliability.
msqg: use futex for IPC notifications commaai/msgq#625 is a soluton
d86738b
to
6591636
Compare
1ae1769
to
0f51583
Compare
0f51583
to
e3e54fb
Compare
This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity. |
d38ad39
to
a90cfc0
Compare
@deanlee now PJ streaming looks rather choppy and sometimes skips a split second of data, can you take another look at this? |
@sshane I didn't find issue when reviewing the code. Running |
I found the issue.looks like the old bridge has the same issue too.I'll fix it when back to my computer |
…#32862) implement MSGQ to ZMQ bridge with subscriber-based publishing Co-authored-by: Adeeb Shihadeh <[email protected]> old-commit-hash: 2faa08c
resolve commaai/msgq#282, Implementing an efficient MSGQ to ZMQ bridge that only publishes services with active subscribers.
Changes:
This update ensures efficient resource utilization and scalability by dynamically managing connections based on subscriber activity.