helgrind举报一场没有冲突的比赛 - 这是什么意思?

时间:2017-08-30 14:44:15

标签: valgrind

根据helgrind文档,报告一个种族有两个堆栈跟踪 - 一个检测到竞争,另一个跟踪读取/写入相同位置,不同之前/之后关系。

我有一个案例(下面的完整错误),其中helgrind仅报告竞争位置,但没有冲突位置。那是什么意思?这是一个复杂的代码库,我不知道如何在更简单的代码上重现。通常情况下,我会看到预期的2个堆栈跟踪。

==10720== Possible data race during read of size 4 at 0x89886CC by thread #2
==10720== Locks held: none
==10720==    at 0x5111BDA: proactor_do_epoll (epoll.c:1816)
==10720==    by 0x5111AD9: pn_proactor_wait (epoll.c:1842)
==10720==    by 0x4EB8CF1: proton::container::impl::thread() (proactor_container_impl.cpp:467)
==10720==    by 0x4EB949B: proton::container::impl::run(int) (proactor_container_impl.cpp:509)
==10720==    by 0x4EB5D51: proton::container::run() (container.cpp:83)
==10720==    by 0x40D2F7: main::$_0::operator()() const (multithreaded_client_flow_control.cpp:267)
==10720==    by 0x40D2B4: void std::_Bind_simple<main::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) (functional:1390)
==10720==    by 0x40D284: std::_Bind_simple<main::$_0 ()>::operator()() (functional:1380)
==10720==    by 0x40D178: std::thread::_State_impl<std::_Bind_simple<main::$_0 ()> >::_M_run() (thread:197)
==10720==    by 0x613776E: execute_native_thread_routine (thread.cc:83)
==10720==    by 0x4C34A14: mythread_wrapper (hg_intercepts.c:389)
==10720==    by 0x5E65739: start_thread (pthread_create.c:333)
==10720==  Address 0x89886cc is 44 bytes inside a block of size 1,728 alloc'd
==10720==    at 0x4C30E70: calloc (vg_replace_malloc.c:711)
==10720==    by 0x5329B1E: pn_object_new (object.c:202)
==10720==    by 0x5329E30: pn_class_new (object.c:61)
==10720==    by 0x510F844: new_pconnection_t (epoll.c:697)
==10720==    by 0x510F668: pn_proactor_connect (epoll.c:1217)
==10720==    by 0x4EB742B: proton::container::impl::start_connection(proton::url const&, pn_connection_t*) (proactor_container_impl.cpp:196)
==10720==    by 0x4EB7708: proton::container::impl::open_sender(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, proton::sender_options const&, proton::connection_options const&) (proactor_container_impl.cpp:226)
==10720==    by 0x4EB57F6: proton::container::open_sender(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, proton::sender_options const&, proton::connection_options const&) (container.cpp:97)
==10720==    by 0x4EB58FA: proton::container::open_sender(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, proton::connection_options const&) (container.cpp:52)
==10720==    by 0x40E3C0: sender::sender(proton::container&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (multithreaded_client_flow_control.cpp:80)
==10720==    by 0x40C6DD: main (multithreaded_client_flow_control.cpp:270)
==10720==  Block was alloc'd by thread #1

1 个答案:

答案 0 :(得分:0)

您可以指定3个级别,其中helgrind会记住比赛的“过去”访问权限:

  

- history-level = none | approx | full [full]

默认为已满,表示为每个过去的访问记录堆栈跟踪。然而,这种记录的过去堆栈轨迹的nr是有限的。在您的情况下,可能冲突访问太旧,其堆栈跟踪被“清理”。

您可以通过使用

增加记录的过去堆栈跟踪量来获取过去的堆栈跟踪
  

- conflict-cache-size =“完整”历史记录缓存的N大小[2000000]

如果您有足够的内存,您可以尝试使用最大允许值 (1.5亿)。