文档首页/ 应用性能管理 APM/ 常见问题(2.0)/ Profiler性能分析常见问题/ No AllocTracer symbols found .Are JDK debug symbols installed?报错问题
更新时间:2024-09-20 GMT+08:00
分享

No AllocTracer symbols found .Are JDK debug symbols installed?报错问题

常见问题

内存Profiler依赖JDK的符号信息,如果JDK内无符号信息,则会遇到如下问题:

[ERROR] xxxx Failed to start Continuous Profile Collector

[ERROR] xxxx No AllocTracer symbols found. Are JDK debug symbols installed?

解决方案

如果Java进程运行在容器环境,出现以上报错或者该功能无数据,一般都是由于使用了Alpine基础镜像导致。Alpine基础镜像为了控制体积而去除了JDK调试符号(debug symbols),影响Profiler功能正常使用。建议在基础镜像中为JDK安装调试符(部分JDK版本缺乏对应的调试符包,会导致无法安装)或使用非Alpine基础镜像。

如果是CentOS物理机环境部署应用可通过以下步骤安装调试符:

  1. 执行以下命令,确认是否已经配置了debuginfo的源。

    yum repolist all | grep -i debug

    通过返回信息确认源配置信息是否如下:

    debuginfo/7/x86_64 CentOS-7 - debuginfo - mirrors.huaweicloud.com 启用: 8,760

    如果未配置debuginfo的源,则执行步骤2增加配置;如果已经配置,则执行步骤3

  2. 在Yum配置文件中增加debuginfo的配置。

    vi /etc/yum.repos.d/CentOS-Base.repo
    [debuginfo]
    name=CentOS-$releasever - debuginfo - mirrors.huaweicloud.com
    failovermethod=priority
    baseurl=http://mirrors.huaweicloud.com/centos-debuginfo/$releasever/$basearch/
    gpgcheck=1
    enabled=1
    gpgkey=http://mirrors.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Debug-7

    保存后执行如下命令:

    yum clean all
    yum makecache
    yum-config-manager --enable debuginfo

  3. 安装JDK版本对应的符号信息。

    JDK 8
    yum list installed|grep openjdk    #查询JDK版本。
    java-1.8.0-openjdk.x86_64          1:1.8.0.332.b09-1.el7_9            @updates
    debuginfo-install -y java-1.8.0-openjdk      #安装符号信息。
    JDK 11
    yum list installed|grep openjdk    #查询JDK版本。
    java-11-openjdk.x86_64             1:11.0.15.0.9-2.el7_9              @updates
     
    debuginfo-install -y java-11-openjdk      #安装符号信息。

  4. 检查JDK的符号信息是否已经安装成功。

    gdb $JAVA_HOME/lib/server/libjvm.so -ex 'info address UseG1GC'
    gdb /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre/lib/amd64/server/libjvm.so -ex 'info address UseG1GC'
    GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre/lib/amd64/server/libjvm.so...Reading symbols from /usr/lib/debug/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre/lib/amd64/server/libjvm.so.debug...done.
    done.

    如果安装正确,返回信息如下:

    Symbol "UseG1GC" is static storage at address 0x107f993.

    如果安装失败,返回信息如下:

    No symbol "UseG1GC" in current context.

相关文档