-
Notifications
You must be signed in to change notification settings - Fork 913
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
#1608 revisited: Fix subscription busy wait melodic #1684
#1608 revisited: Fix subscription busy wait melodic #1684
Conversation
@ros-pull-request-builder retest this please |
2 similar comments
@ros-pull-request-builder retest this please |
@ros-pull-request-builder retest this please |
It seems, that If this macro is defined in the test as well, the test, introduced by this PR succeeds, but another tests starts to fail. It seems, that the macro can cause problems with `boost::this_thread::sleep``- Anyway. the ODR-violations are a potentially serious issue and should be avoided. #1651 might help here. |
Hey Christopher. Thanks very much for developing this further! Are you with Open Robotics, or did you start working on it on your own? =) I can't believe the solution is really so simple, but I was never good at multithreaded code :) Is there anything I can help with? |
Congrats for finishing your studies ;) Well, I don't think there is a direct dependency on #1651 (or is there?), but it's true that these two changes would be good to be tested together, since there might be some hidden problems. |
Okay. Let me know if you need any help. |
#ifndef __APPLE__ | ||
#define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC | ||
#endif | ||
|
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.
Your patch works fine for me even without #1651.
But why was this section removed independently of https://github.com/ros/ros_comm/pull/1651/files#diff-5f391de72dc7aa5abcad51904f99a29a? With Boost <1.61 (e.g. in Ubuntu Xenial) the preprocessor check in callback_queue.cpp:43 triggers an error now. For all Boost versions <1.67 condition variables use the non-monotonic system clock by default, with undesired behavior in case of jumps in system time, but condition_variable::wait_for
and condition_variable::wait_until
will still do the right thing in both cases.
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.
Removing this lines makes the tests pass. The problem is, that with this lines the definition of condition_variable is differente in callback_queue and in the tests. This ODR-violation leads to test failures.
With #1878 merged please rebase this patch to check the tests with both patches together. |
3db1254
to
52dfdb1
Compare
Ok, it gets even more complicated now. First of all: the new tests work, if ros_comm is build in release mode. In Debug-Mode there are ODR-problems with test_roscpp. If BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC is set for test_roscpp, the new tests are working, but all test using boost::posix_time are running forever (or at least very long). It turns out that boost::posix_time relies on the shared/static-library part of boost.thread which is shipped precompiled. In this precompiles parts a function of boost::posix_time is implemented using boost:condition_variable, which has been compiled without BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC set. This again seems to cause ODR-problems. We could ban boost::posix_time from ros_comm, to fix this. Everything would still work for the usual user who uses the prebuild packages. But people, who build ros_comm in Debug-Mode and build their stuff using this build AND are using boost::posix_time, will encounter serious issues. |
+1 for eliminating As suggested in #1878 (comment), compiling Unfortunately switching to
Summary: The pthread C API does allow to use condition variables with a Would it be an option to simply not define |
Any more thoughts on this? It'd be nice to have this solved in melodic. |
@ros-pull-request-builder retest this please |
This PR solves a different issue than #1932. This PR tackles the issue that if callbacks take too long, a multithreaded spinner busy waits on all threads because of a missing lock. PR #1932 solves just a problem with steady timers. However, these PRs are related a bit in the CMakeLists.txt. This PR adds a workaround for the non-monotonic steady timers, while PR #1932 solves that issue directly, rendering the workaround from this PR useless. So I'd suggest merging #1932 first, adapting this PR to utilize the fixes from #1932, and merging this PR if all tests are green. |
I locally tested a rebase of this PR onto melodic-devel with the CMakeLists.txt changes left out, and all @cwecht do you have time today to do the change? If not, I can send another PR so that the change can be accepted in time before the next melodic release... But creating another (third, fourth?) PR for this change would just increase the mess... This is the result of
|
…of system-time changes
749246e
to
1ae22ec
Compare
@cwecht Is the pull request ready for review / merge? |
I've just rebased this branch. From my side, yes, it is ready for review. But I did not kept track of the most recent changes in ros_comm. Maybe e.g. @meyerj should have a final look on this as well. |
I plan to merge this and make a release on Friday morning (PDT)... |
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.
Sorry, I don't have time right now for a full review, or even to test the patch. But I can confirm that it is not replacing #1932 nor does this patch replace #1932. They are solving different problems with similar symptoms.
The block that includes the non-existent "boost_161_condition_variable.h"
header conditionally can be simply removed.
Are there plans to backport those recent patches to kinetic-devel
or forward port to noetic-devel
?
Co-authored-by: Johannes Meyer <[email protected]>
I don't plan to backport these changes to I also don't plan to forward port any changes to Noetic. If the change would be necessary in Noetic it should have landed there in the first place. That being said if anything needs to be applied to other branches please create PRs for it. Thanks. |
@cwecht @dirk-thomas Please also consider my proposal to simplify I did not test the patch anymore recently and after #1878 and #1932, but at first glance I still think that it would be a cleaner and shorter implementation and we are using it in our internal builds of ROS melodic since more than a year now. |
This replaces #1608 . It fixes the same issue without breaking API/ABI.