-
Notifications
You must be signed in to change notification settings - Fork 88
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
Protect pop() and pop_back() operations with a mutex #839
Conversation
… twice the same element
Refer to this link for build results (access rights to CI server needed): Build Log
Test FAILed. |
I modified a bit the code so that it should be retro-compatible for Ubuntu 12.04 with boost 1.48 (The location of lock_guard() was changed between 1.48 and 1.54). @k-okada : can you confirm which version of boost you are using ? I checked and it seems that the default version on 8.04 was 1.34 that does not implement lock_guard. In that case, we will have to put some preprocessor guards and use scoped_lock instead (It has been deprecated since and is no longer present in 1.54...) |
Refer to this link for build results (access rights to CI server needed): |
Dear haudren. Sorry for late reply.
In order to processor guards, what do you think about using this? Moreover, why are you adding guards to |
FYI: A table in this comment shows a boost version of each JSK robot. #751 (comment) |
@snozawa For your other remark, the problem comes when someone pops_back() and pops() at the same time the last element. I wanted to protect the stack at the closest of the problem, in order to also avoid crashes in other components that may rely on interpolator. For me the question is the following: while clearing, should the SequencePlayer continue playing the current pattern ? Do we want to protect the stack against double-free in the SequencePlayer only or every component ? |
As I commented in the issue, this is also present in the robot, and thus may crash the robot whenever clearing the SequencePlayer (Or any interpolator that is also being popped at the same time). @fkanehiro : Any opinion on how we can fix this problem ? I think using coil::Guard is the best option, but where to put them ? |
Hello, I just updated my branch to use coil::Guardcoil::Mutex. If anyone would prefer me to move the guards higher up (In seqplay for example) please say so. @fkanehiro : Any opinion on this matter ? |
Refer to this link for build results (access rights to CI server needed): |
sorry for late response, could you send PR for version which uses coil? Thanks in advance. ◉ Kei Okada On Fri, Oct 16, 2015 at 10:45 AM, Hervé Audren notifications@github.com
|
Ok so the test passed on QNX, but the build errored on Travis due to:
I guess the virtual machine ran out of memory or something similar... |
Travis also passed, If this is ok, please merge @fkanehiro |
Sorry for late reply, too, and LGTM. |
Protect pop() and pop_back() operations with a mutex
This avoids popping twice the same element, that results in a double free and crash, see #837.
This PR should be retrocompatible with 8.04 and older releases, as long as they support boost::lock_guard (In boost_thread). It especially avoids depending on newer C++0x or C++11 constructs.
This adds a link dependency on boost_system on many components, because AutoBalancer and EmergencyStopper directly include interpolator.cpp. I think this is a bad practice and should be avoided, but I wanted to keep the impact of this PR minimal.
@k-okada can you confirm that this builds on your side ? I am not sure of which version of Boost you are using, and in which version lock_guard was introduced.
I think that the lock is mostly uncontested so this should not cause any performance issues, but tell me if you run into problems.