Skip to content
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

Changed listener to not busy-wait #13157

Merged
merged 2 commits into from
Oct 17, 2019
Merged

Conversation

AmeliaEScott
Copy link
Contributor

Describe problem solved by the proposed pull request
Under certain circumstances, when running the listener command with the -n argument, it would incorrectly timeout. For example, by using uorb top, I can see that the telemetry_status message is being published once per second. However, when running listener telemetry_status -n 100, I receive two messages, then the message Waited for 2 seconds without a message. Giving up.

Test data / coverage
I ran a series of listener commands on different topics, with every possible combination of the -i, -r, and -n parameters.

Describe your preferred solution
I suspect that the issue had something to do with the listener performing a busy-wait between messages, therefore using up all available CPU. This can be demonstrated by running listener cpuload -n 10 and observing that the load on every message except for the first is 100%. So, I changed the listener to poll on messages asynchronously. This fixed the issue with telemetry_status.

Additional context
Some work has been done recently on the listener, in #12799 and #13006 .

Copy link
Contributor

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

src/systemcmds/topic_listener/listener_main.cpp Outdated Show resolved Hide resolved
src/systemcmds/topic_listener/listener_main.cpp Outdated Show resolved Hide resolved
@julianoes julianoes merged commit cf8f03f into PX4:master Oct 17, 2019
@AmeliaEScott AmeliaEScott deleted the pr-listener-fix branch October 17, 2019 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants