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 valgrind issue of uninitialized next value in node #48

Closed
yuvalif opened this issue Jan 20, 2019 · 0 comments
Closed

fix valgrind issue of uninitialized next value in node #48

yuvalif opened this issue Jan 20, 2019 · 0 comments

Comments

@yuvalif
Copy link
Contributor

yuvalif commented Jan 20, 2019

The following two errors appear in all queue related tests when running under valgrind (valgrind-3.14.0).
valgrind output when running the queue example binary:

==29902== Conditional jump or move depends on uninitialised value(s)
==29902==    at 0x415273: std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>, std::memory_order, std::memory_order) (atomic:288)
==29902==    by 0x414292: std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node> >::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int>::node>, std::memory_order) (atomic:308)
==29902==    by 0x412C88: bool boost::lockfree::queue<int>::do_push<false>(int const&) (queue.hpp:318)
==29902==    by 0x41135A: boost::lockfree::queue<int>::push(int const&) (queue.hpp:280)
==29902==    by 0x40C711: producer() (queue.cpp:27)
==29902==    by 0x416302: boost::detail::thread_data<void (*)()>::run() (thread.hpp:117)
==29902==    by 0x4E59475: thread_proxy (thread.cpp:177)
==29902==    by 0x61E9593: start_thread (in /usr/lib64/libpthread-2.27.so)
==29902==    by 0x64FAF4E: clone (in /usr/lib64/libc-2.27.so)
==29902== 
==29902== Conditional jump or move depends on uninitialised value(s)
==29902==    at 0x412C8B: bool boost::lockfree::queue<int>::do_push<false>(int const&) (queue.hpp:318)
==29902==    by 0x41135A: boost::lockfree::queue<int>::push(int const&) (queue.hpp:280)
==29902==    by 0x40C711: producer() (queue.cpp:27)
==29902==    by 0x416302: boost::detail::thread_data<void (*)()>::run() (thread.hpp:117)
==29902==    by 0x4E59475: thread_proxy (thread.cpp:177)
==29902==    by 0x61E9593: start_thread (in /usr/lib64/libpthread-2.27.so)
==29902==    by 0x64FAF4E: clone (in /usr/lib64/libc-2.27.so)

As I understand, this is not a real issue, since it does not matter which tag we use at the beginning, as long as we increment it, however, it does create noise when running with valgrind, and does not seem to have any cost in perf.
Also, the fix is simple, as it could be done by uncommenting existing code in the ctor of the node class in queue.hpp

yuvalif added a commit to yuvalif/lockfree that referenced this issue Jan 20, 2019
Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
timblechmann added a commit that referenced this issue Feb 21, 2019
@yuvalif yuvalif closed this as completed May 15, 2019
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

No branches or pull requests

1 participant