Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncProfiler Java API crashes the JVM #865

Closed
omarmahamid opened this issue Dec 12, 2023 · 1 comment
Closed

AsyncProfiler Java API crashes the JVM #865

omarmahamid opened this issue Dec 12, 2023 · 1 comment

Comments

@omarmahamid
Copy link

omarmahamid commented Dec 12, 2023

Hi,

I'm using this peace of code (which is Java API for Async Profiler)

<dependency>
            <groupId>tools.profiler</groupId>
            <artifactId>async-profiler</artifactId>
            <version>2.9</version>
        </dependency>
        AsyncProfiler profiler = AsyncProfiler.getInstance();

        // Start profiling
        profiler.execute("start,event=cpu,file=startup-cpu-profile.html,interval=1000000,simple");

        // Code to be profiled
        Set<String> set = new HashSet<>();
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100000000; i++) {
            boolean in = set.contains(String.valueOf(i).toUpperCase());
            BigDecimal bigDecimal = new BigDecimal("-21.2");
            bigDecimal.divide(new BigDecimal("-213.22"));
        }
        System.out.println("took: " + (System.currentTimeMillis() - start));

        Thread.sleep(10000);

        // Stop profiling
        profiler.execute("stop,file=startup-cpu-profile.html");

and I got that the JVM crash

hs_err_pid83592.log

also when I'm using other permutation

if I replace

profiler.execute("start,event=cpu,file=startup-cpu-profile.html,interval=1000000,filter");

It works but the flamegraph is empty

image

any ideas ?

@apangin
Copy link
Collaborator

apangin commented Dec 12, 2023

According to the crash log, the bug happened with JDK 17.0.8 on macOS/ARM in StubRoutines::SafeFetch32.

That's the exact duplicate of #817 and has been already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants