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

Fix memory corruption due to publisher-multithreading #16

Merged
merged 1 commit into from Jan 18, 2023

Conversation

jk-ethz
Copy link
Member

@jk-ethz jk-ethz commented Jan 9, 2023

For us, the publishing in a separate thread was causing memory corruption and crashes that occurred only sporadically and when ICP was running for an extended period of time (> 1 h). This is likely due to the lack of a mutex mechanism, resulting in reading data to publish while data might be changing from the other thread.

Also, since the publisher thread gets spawned and destroyed on every loop cycle, the time gain was not noticable for us. If it is still desired, a more optimal way would probably be to use a thread that gets spawned once and then gets fed data to publish by a mutexed queuing mechanism (which the ROS publishers have probably built-in already anyway).

See ethz-asl/moma#149

@jelavice jelavice merged commit 419d102 into leggedrobotics:master Jan 18, 2023
@jelavice
Copy link
Collaborator

Thank you for fixing this! Apologies for not reviewing earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants