Skip to content

DLPX-88488 profile is missing stack traces#16

Merged
sumedhbala-delphix merged 1 commit into
developfrom
dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53
Nov 7, 2023
Merged

DLPX-88488 profile is missing stack traces#16
sumedhbala-delphix merged 1 commit into
developfrom
dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53

Conversation

@sumedhbala-delphix

@sumedhbala-delphix sumedhbala-delphix commented Nov 6, 2023

Copy link
Copy Markdown
Contributor

Clean cherrypick of b2e9c36
Testing: ab-pre-push passed

Ran the following to figure out number of entries on a 4 core system
without the change:
"""
delphix@ip-10-110-214-21:/var/delphix/server/log/stats$ grep -v '^-' profile_3600.log | grep -o ' [0-9]$' | paste -s -d+ - | bc
721214
"""
721214/(60
60499) = ~50% hit rate

with the change:
"""
delphix@ip-10-110-238-208:/var/delphix/server/log/stats$ grep -v '2023-11-01' profile_3600.log | grep -o ' [0-9]$' | paste -s -d+ - | bc
1237787
"""
1237787/(60
60499) = ~80% hit rate

I doubled the default hash to 81920 and we got to 83% hit rate, does not seem like we gain too much with increasing the hash size.

@sumedhbala-delphix sumedhbala-delphix force-pushed the dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53 branch from 2e6ff3b to b2e9c36 Compare November 6, 2023 18:46
@sumedhbala-delphix sumedhbala-delphix marked this pull request as ready for review November 6, 2023 18:57
@sumedhbala-delphix sumedhbala-delphix force-pushed the dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53 branch from b2e9c36 to e7e3701 Compare November 6, 2023 22:51
@sumedhbala-delphix sumedhbala-delphix force-pushed the dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53 branch from e7e3701 to 588a87d Compare November 6, 2023 22:51
@sumedhbala-delphix sumedhbala-delphix changed the title tools/profile: Allow to increment hash storage size to aviod missing keys DLPX-88488 profile is missing stack traces Nov 6, 2023
@sumedhbala-delphix sumedhbala-delphix merged commit f1d8983 into develop Nov 7, 2023
@sumedhbala-delphix sumedhbala-delphix deleted the dlpx/pr/sumedhbala-delphix/38c83bee-76f9-4c73-b85c-15eb79f3de53 branch November 7, 2023 21:36
tonynguien pushed a commit that referenced this pull request Feb 27, 2026
…tacktrace (#4902)

offcputime may display inaccurate DSO information in the stacktrace.
Here's an example of the issue:

It shows the same DSO offset for different addresses, which is incorrect.
  $ ./offcputime -v
    ..
    #14 0x00007f8b912a8c (/usr/lib/libcbe.so_0x22afa8c)
    #15 0x000044000a3ee0 (/usr/lib/libcbe.so_0x22afa8c)
    #16 0x000044001fc56c (/usr/lib/libcbe.so_0x22afa8c)

This is why syms__map_addr_dso simply returns NULL when syms__find_dso also
returns NULL. In that case, the values of dso_name and dso_offset are not
changed. If the dso_name and dso_offset variables have a garbage value before
calling syms__map_addr_dso, those garbage values are maintained after calling
syms__map_addr_dso.

This patch fixes the issue by reinitializing dso_name and dso_offset variables
before calling syms__map_addr_dso.

Co-authored-by: Eunseon Lee <es.lee@lge.com>
tonynguien pushed a commit that referenced this pull request Feb 27, 2026
offcputime may display inaccurate DSO information in the stacktrace.
Here's an example of the issue:

It shows the same DSO offset for different addresses, which is incorrect.
  $ ./offcputime -v
    ..
    #14 0x00007f8b912a8c (/usr/lib/libcbe.so_0x22afa8c)
    #15 0x000044000a3ee0 (/usr/lib/libcbe.so_0x22afa8c)
    #16 0x000044001fc56c (/usr/lib/libcbe.so_0x22afa8c)

This is why syms__map_addr_dso simply returns NULL when syms__find_dso also
returns NULL. In that case, the values of dso_name and dso_offset are not
changed. If the dso_name and dso_offset variables have a garbage value before
calling syms__map_addr_dso, those garbage values are maintained after calling
syms__map_addr_dso.

To ensure consistent usage of DSO info and symbol info, the prototype of
syms__map_addr_dso has been modified to be similar to dladdr[1].

This is the prototype of dladdr:
  int dladdr(void *addr, Dl_info *info);

The information is returned in a Dl_info structure. If no symbol matching addr
could be found, then dli_sname and dli_saddr are set to NULL.
  typedef struct {
      const char *dli_fname;  /* Pathname of shared object that
                                contains address */
      void       *dli_fbase;  /* Base address at which shared
                                object is loaded */
      const char *dli_sname;  /* Name of symbol whose definition
                                overlaps addr */
      void       *dli_saddr;  /* Exact address of symbol named
                                in dli_sname */
   } Dl_info;

Similarly, if no symbol matching the addr could be found, then sym_name and
sym_offset are set to NULL in syms__map_addr_dso of this patch.

Also, apply the modified API usage to offcputime, futexctn, and memleak.

[1] https://man7.org/linux/man-pages/man3/dladdr.3.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants