Description
helgrind generated a number of issues, I pulled a bunch of them. Most are related to the test, some are really issues with the mt zk client code though:
valgrind --tool=helgrind --log-file=helgrind_mt.out ./zktest-mt
==31294== Thread #2: pthread_cond_
{timed}wait called with un-held mutex==31294== at 0x4027F8F: pthread_cond_wait@* (hg_intercepts.c:560)
==31294== by 0x404D881: pthread_cond_wait@GLIBC_2.0 (in /lib/tls/i686/cmov/libpthread-2.8.90.so)
==31294== by 0x4028037: pthread_cond_wait@* (hg_intercepts.c:574)
==31294== by 0x809EBB7: pthread_cond_wait (PthreadMocks.cc:54)
==31294== by 0x80ABCF6: notify_thread_ready (mt_adaptor.c:136)
==31294== by 0x80ABE90: do_io (mt_adaptor.c:277)
==31294== Possible data race during write of size 4 at 0x42E9A58
==31294== at 0x8050D83: terminateZookeeperThreads(_zhandle*) (ZKMocks.cc:518)
==31294== by 0x805543B: DeliverWatchersWrapper::call(_zhandle*, int, int, char const*, watcher_object_list**) (ZKMocks.cc:261)
==31294== by 0x80520F7: __wrap_deliverWatchers (ZKMocks.cc:220)
==31294== by 0x80A287B: process_completions (zookeeper.c:1393)
==31294== by 0x80ABDAA: do_completion (mt_adaptor.c:332)
==31294== Possible data race during write of size 4 at 0xBEFF5F30
==31294== at 0x80589AF: Zookeeper_watchers::ConnectionWatcher::~ConnectionWatcher() (TestWatchers.cc:54)
==31294== by 0x805D062: Zookeeper_watchers::testDefaultSessionWatcher1() (TestWatchers.cc:438)
==31294== by 0x805608C: CppUnit::TestCaller<Zookeeper_watchers>::runTest() (TestCaller.h:166)
==31294== Possible data race during write of size 4 at 0x42EB104
==31294== at 0x80A03EE: queue_completion (zookeeper.c:1776)
==31294== by 0x80A3A44: zookeeper_process (zookeeper.c:1598)
==31294== by 0x80AC00B: do_io (mt_adaptor.c:309)
==31294== Thread #29: pthread_cond_{timed}
wait called with un-held mutex
==31294== at 0x4027F8F: pthread_cond_wait@* (hg_intercepts.c:560)
==31294== by 0x404D881: pthread_cond_wait@GLIBC_2.0 (in /lib/tls/i686/cmov/libpthread-2.8.90.so)
==31294== by 0x4028037: pthread_cond_wait@* (hg_intercepts.c:574)
==31294== by 0x809EBB7: pthread_cond_wait (PthreadMocks.cc:54)
==31294== by 0x80AB9B3: wait_sync_completion (mt_adaptor.c:82)
==31294== by 0x80A1E82: zoo_wget (zookeeper.c:2517)
==31294== by 0x80A1F13: zoo_get (zookeeper.c:2497)