Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
743 stars 54 forks source link

java: Upgrade to async-profiler v2.10 and use asprof jattach passthru #776

Closed marcin-ol closed 1 year ago

marcin-ol commented 1 year ago

An attempt at integrating upcoming features of async-profiler in particular: binary launcher (asprof).
This is a first approach adding a passthru mechanism for invocation of jattach with asprof.

Asprof was extended with following capabilities:

Description

This is a first approach adding a passthru mechanism for invocation of jattach with asprof.

Asprof was extended with following capabilities:

Related Issue

745

Motivation and Context

We want to prepare for upcoming release of async-profiler, bringing new features and fixes.

How Has This Been Tested?

Checklist:

Jongy commented 1 year ago

@marcin-ol , once ready for review please post in the description a link to the AP-side PR.

marcin-ol commented 1 year ago

Async-profiler PR: Granulate/async-profiler#7

Jongy commented 1 year ago

@marcin-ol about the failures:

marcin-ol commented 1 year ago

@marcin-ol about the failures:

  • FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEI0gWreZ/gprofiler/resources/java/asprof' is most likely because asprof is not built statically. The ENOENT error comes from execve failing to find the "interpreter" for this file, which is ld.so of glibc, as this file is meant to run on glibc, not musl. Like we did for jattach, built it statically (or else, it needs to run via staticx, but I prefer static)

It seems to be the only required change to make it work.

  • CentOS 6 failure - you can read here about what we had in the past (force linking specific symbols against older version of them, so we don't require new glibc), after that PR we just built directly against glibc headers of CentOS 6, installed on CentOS 7 as "glibc-compat". This is done by this commit. I'd start by verifying that it was applied and used in the build of 2.10 correctly.

This error is related to the asprof launcher itself. Linking it statically should fix gprofiler on centos:6 as well.