【问题标题】:helgrind reports a race with no conflict - what does that mean?helgrind 报告了一场没有冲突的比赛——这是什么意思?
【发布时间】:2017-08-30 14:44:14
【问题描述】:

根据 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

【问题讨论】:

    标签: valgrind


    【解决方案1】:

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

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

    默认为full,这意味着记录每次过去访问的堆栈跟踪。但是,此类记录的过去堆栈跟踪的数量是有限的。在您的情况下,可能冲突的访问太旧了,并且它的堆栈跟踪已被“清理”。

    您可以通过使用

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-31
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-28
      • 2015-07-24
      • 2021-09-15
      相关资源
      最近更新 更多