valgrind:尝试调试在Docker容器中运行的C ++程序时,堆块lo / hi大小不匹配

问题描述 投票:0回答:1

[当尝试调试C ++二进制文件时,我遇到以下问题。

valgrind: m_mallocfree.c:307 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 1, hi = 4294967295.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.  If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away.  Please try that before reporting this as a bug.


host stacktrace:
==1747==    at 0x58013284: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x58013397: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x58013531: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x5801BD6D: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x5800CDC1: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580614A7: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580737A7: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580738DC: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580C9561: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580C96AA: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0x580720CD: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==1747==    by 0xDEADBEEFDEADBEEE: ???
==1747==    by 0xDEADBEEFDEADBEEE: ???
==1747==    by 0xDEADBEEFDEADBEEE: ???

sched status:
  running_tid=47

Thread 47: status = VgTs_Runnable (lwpid 1861)
==1747==    at 0x4C2922D: free (vg_replace_malloc.c:540)
==1747==    by 0x9A7CB7B: __libc_freeres (in /usr/lib64/libc-2.17.so)
==1747==    by 0x4A24739: _vgnU_freeres (vg_preloaded.c:77)
client stack range: ??????? client SP: 0x289569C8
valgrind stack range: [0x1009516000 0x1009615FFF] top usage: 5064 of 1048576

但是有趣的事实是,当相同的二进制文件在容器外部(在VM上)运行时,它可以很好地工作。如果我的源二进制文件具有内存链接(按照Valgrind常见问题解答),那么我为什么不在容器中不运行时为什么没有遇到问题感到困惑。

任何帮助表示赞赏。

c++ docker valgrind
1个回答
0
投票

最有可能是此问题:https://github.com/sfackler/rust-postgres/issues/74#issuecomment-301464576

我在基于centos:7的Docker容器中遇到了这个问题,也可以使用--tool=memcheck复制它。将--run-libc-freeres=no添加到valgrind调用中为我解决了该问题。

© www.soinside.com 2019 - 2024. All rights reserved.