bcc icon indicating copy to clipboard operation
bcc copied to clipboard

offcputime report too much [unknown] while debuginfo file under /usr/lib/debug/

Open fish2bird opened this issue 2 years ago • 0 comments

Hi, I have a [unknown] issue only in offcputime report, which expected resolved from /usr/lib/debug/usr/lib64/libc-2.28.so.debug

the installed debuginfo works well with gdb, perf and etc

here is strace report, /usr/lib/debug/proc/9597/root/usr/lib64/libc-2.28.so.debug seem suspicious

[root@Insight-8324 ~]# cat /tmp/strace.offcputime.log | grep libc-2.28.so.debug
223287 pread64(8, "libc-2.28.so.debug\0\0og\237\336", 24, 1456748) = 24
223287 newfstatat(AT_FDCWD, "/proc/9597/root/usr/lib64/libc-2.28.so.debug", 0xffffdf3872c8, 0) = -1 ENOENT (No such file or directory)
223287 faccessat(AT_FDCWD, "/proc/9597/root/usr/lib64/libc-2.28.so.debug", F_OK) = -1 ENOENT (No such file or directory)
223287 faccessat(AT_FDCWD, "/proc/9597/root/usr/lib64/.debug/libc-2.28.so.debug", F_OK) = -1 ENOENT (No such file or directory)
223287 faccessat(AT_FDCWD, "/usr/lib/debug/proc/9597/root/usr/lib64/libc-2.28.so.debug", F_OK) = -1 ENOENT (No such file or directory)

and here is stack

223287 newfstatat(AT_FDCWD, "/proc/9597/root/usr/lib64/libc-2.28.so.debug", 0xffffdf3872c8, 0) = -1 ENOENT (No such file or directory)
 > /usr/lib64/libc-2.28.so(__xstat+0x14) [0xc666c]
 > /usr/lib64/libbcc.so.0.15.0() [0x305de7]
 > /usr/lib64/libbcc.so.0.15.0() [0x30614f]
 > /usr/lib64/libbcc.so.0.15.0(ProcSyms::Module::load_sym_table()+0xff) [0x2ff2ff]
 > /usr/lib64/libbcc.so.0.15.0(ProcSyms::Module::find_addr(unsigned long, bcc_symbol*)+0x37) [0x2ff3af]
 > /usr/lib64/libbcc.so.0.15.0(ProcSyms::resolve_addr(unsigned long, bcc_symbol*, bool)+0x14b) [0x2ff793]
 > /usr/lib64/libbcc.so.0.15.0(bcc_symcache_resolve+0x17) [0x2fb28f]
 > /usr/lib64/libffi.so.7.1.0() [0x6177]
 > /usr/lib64/libffi.so.7.1.0() [0x576b]
 > /usr/lib64/python3.7/lib-dynload/_ctypes.cpython-37m-aarch64-linux-gnu.so(_ctypes_callproc+0x40f) [0x11e2f]

I thinks root cause here: ProcSyms::_add_module miss readlink as bcc_perf_map_path do

int ProcSyms::_add_module(mod_info *mod, int enter_ns, void *payload) {
  ProcSyms *ps = static_cast<ProcSyms *>(payload);
  std::string ns_relative_path = tfm::format("/proc/%d/root%s", ps->pid_, mod->name);
  const char *modpath = enter_ns && ps->pid_ != -1 ? ns_relative_path.c_str() : mod->name;
bool bcc_perf_map_path(char *map_path, size_t map_len, int pid) {
  char source[64];
  snprintf(source, sizeof(source), "/proc/%d/root", pid);

  char target[4096];
  ssize_t target_len = readlink(source, target, sizeof(target) - 1);
  if (target_len == -1)
    return false;

My OS is EulerOS (from CentOS)

Thanks.

fish2bird avatar Sep 29 '22 09:09 fish2bird