diff --git a/docs/en/community/developer-guide/debug-tool.md b/docs/en/community/developer-guide/debug-tool.md index ae9a161f66b774..0be5537336524b 100644 --- a/docs/en/community/developer-guide/debug-tool.md +++ b/docs/en/community/developer-guide/debug-tool.md @@ -254,6 +254,10 @@ The directory where the heap dump file is located is `${DORIS_HOME}/log` by defa ##### 3. jemalloc heap dump profiling +``` +Requires addr2line 2.35.2, see below QA 1. +``` + 1. A single heap dump file generates plain text analysis results ```shell jeprof lib/doris_be heap_dump_file_1 @@ -282,6 +286,41 @@ The directory where the heap dump file is located is `${DORIS_HOME}/log` by defa jeprof --pdf lib/doris_be --base=heap_dump_file_1 heap_dump_file_2 > result.pdf ``` +##### 4. QA + +1. Many errors occurred after running jeprof: `addr2line: Dwarf Error: found dwarf version xxx, this reader only handles version xxx` + +After GCC 11, DWARF-v5 is used by default, which requires Binutils 2.35.2 and above. Doris Ldb_toolchain uses GCC 11. See: https://gcc.gnu.org/gcc-11/changes.html. + +Replace addr2line to 2.35.2, refer to: +``` +// Download addr2line source code +wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.bz2 + +//Install dependencies, if needed +yum install make gcc gcc-c++ binutils + +// Compile & install addr2line +tar -xvf binutils-2.35.tar.bz2 +cd binutils-2.35 +./configure --prefix=/usr/local +make +make install + +// verify +addr2line -h + +// Replace addr2line +chmod +x addr2line +mv /usr/bin/addr2line /usr/bin/addr2line.bak +mv /bin/addr2line /bin/addr2line.bak +cp addr2line /bin/addr2line +cp addr2line /usr/bin/addr2line +hash -r +``` + +Note that you cannot use addr2line 2.3.9, which may be incompatible and cause memory to keep growing. + #### LSAN [LSAN](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer) is an address checking tool, GCC has been integrated. When we compile the code, we can enable this function by turning on the corresponding compilation options. When the program has a determinable memory leak, it prints the leak stack. Doris be has integrated this tool, only need to compile with the following command to generate be binary with memory leak detection version. diff --git a/docs/zh-CN/community/developer-guide/debug-tool.md b/docs/zh-CN/community/developer-guide/debug-tool.md index 40078edc439c2d..5c58077bc34ba5 100644 --- a/docs/zh-CN/community/developer-guide/debug-tool.md +++ b/docs/zh-CN/community/developer-guide/debug-tool.md @@ -257,6 +257,10 @@ heap dump文件所在目录默认为 `${DORIS_HOME}/log`, 文件名前缀是 `JE ##### 3. heap dump profiling +``` +需要 addr2line 版本为 2.35.2, 见下面的 QA 1. +``` + 1. 单个heap dump文件生成纯文本分析结果 ```shell jeprof lib/doris_be heap_dump_file_1 @@ -285,6 +289,40 @@ heap dump文件所在目录默认为 `${DORIS_HOME}/log`, 文件名前缀是 `JE jeprof --pdf lib/doris_be --base=heap_dump_file_1 heap_dump_file_2 > result.pdf ``` +##### 4. QA + +1. 运行 jeprof 后出现很多错误: `addr2line: Dwarf Error: found dwarf version xxx, this reader only handles version xxx`. + +GCC 11 之后默认使用 DWARF-v5 ,这要求Binutils 2.35.2 及以上,Doris Ldb_toolchain 用了 GCC 11。see: https://gcc.gnu.org/gcc-11/changes.html。 + +替换 addr2line 到 2.35.2,参考: +``` +// 下载 addr2line 源码 +wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.bz2 + +// 安装依赖项,如果需要 +yum install make gcc gcc-c++ binutils + +// 编译&安装 addr2line +tar -xvf binutils-2.35.tar.bz2 +cd binutils-2.35 +./configure --prefix=/usr/local +make +make install + +// 验证 +addr2line -h + +// 替换 addr2line +chmod +x addr2line +mv /usr/bin/addr2line /usr/bin/addr2line.bak +mv /bin/addr2line /bin/addr2line.bak +cp addr2line /bin/addr2line +cp addr2line /usr/bin/addr2line +hash -r +``` +注意,不能使用 addr2line 2.3.9, 这可能不兼容,导致内存一直增长。 + #### LSAN [LSAN](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer)是一个地址检查工具,GCC已经集成。在我们编译代码的时候开启相应的编译选项,就能够开启这个功能。当程序发生可以确定的内存泄露时,会将泄露堆栈打印。Doris BE已经集成了这个工具,只需要在编译的时候使用如下的命令进行编译就能够生成带有内存泄露检测版本的BE二进制