-
Notifications
You must be signed in to change notification settings - Fork 432
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
Multi-threaded Executor starvation fix #2702
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: HarunTeper <[email protected]>
The proposed changes, as well as the paper, don't make sense to me. But this might be a wording vs implementation issue. Lets wait for the actual implementation... |
Hi @HarunTeper, The next Client Library WG meeting will happen Friday 12/20/2024 at 8AM PST. |
I would likely join the next meeting, and work on the pull request until then. Sorry for not making it to the last one. |
…ead of busy wait Signed-off-by: HarunTeper <[email protected]>
I have now uploaded my fix for humble to a custom repository: https://github.com/HarunTeper/rclcpp_humble_multithreaded_executor You can see the changes in the branch called "fix". I am currently working on applying the same changes to the current version of the multi-threaded executor. However, since Humble, the code of the executor itself, specifically the wait set and wait_for_work functions are very different. I will try to implement the version that I propose, however, it will be different from my previous solution. For example, I think the current version has threads busy waiting for tasks to become ready if all tasks are blocked but not all threads are currently executing tasks. If there is another meeting, I will join that one to talk about the executor. In the meantime, I will work on the fix. |
I had a look at the 'fix' implementation. As far as I can see, this comes down to:
While I think, this fix works, the implementation is awkward, in the sense that the code flow is extremely hard to follow. To be fair, the executor code flow isn't great in the first place... I would suggest a different approach to the problem:
Poll for events:
Worker threads:
This is basically the logic I use in the EventsCBGExecutor. |
Pull request addressing the issues in #2360 #2645.
So far, I have added a test that detects starvation in the multi-threaded executor.
This test includes a mutually-exclusive callback group with two timers.
The executor should be alternating between these two tasks, never executing one task twice before the other.
To fix starvation, I have identified the following steps (which I was not able to completely implement yet):
These steps are based on the work I published here:
https://ieeexplore.ieee.org/document/9622336
https://daes.cs.tu-dortmund.de/storages/daes-cs/r/publications/teper2024emsoft_preprint.pdf
I have already tried to implement some of these steps, and I will also commit some of the changes to this fork this week. However, for step 4, I may require some help. I also noticed that my changes break some of the tests are currently part of rclcpp, as I move the functions that set callback group flags and trigger guard conditions.