KEMBAR78
Crash on SafeAccess::load · Issue #1412 · async-profiler/async-profiler · GitHub
Skip to content

Crash on SafeAccess::load #1412

@Baraa-Hasheesh

Description

@Baraa-Hasheesh

Describe the bug

while refactoring the regularPeak test, I observed a random JVM crash while running the following

package test.jfr;

import java.util.concurrent.ThreadLocalRandom;

public class CpuPeak {

    private static void cpuLoad() {
        double sum = 0;
        for (int i = 0; i < 1000; i++) {
            sum += Math.pow(ThreadLocalRandom.current().nextDouble(5), ThreadLocalRandom.current().nextDouble(5));
        }
    }

    private static void consistentCpuLoad() {
        long startTime = System.currentTimeMillis();

        while (System.currentTimeMillis() - startTime < 5000) {
            cpuLoad();
            try {
                Thread.sleep(20);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    private static void peakCpuLoad() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        cpuLoad();
    }

    public static void main(String[] args) throws Exception {
        Thread thread1 = new Thread(CpuPeak::consistentCpuLoad);
        thread1.start();

        peakCpuLoad();

        thread1.join();
    }
}

Expected vs. actual behavior

async-profiler shouldn't crash

Reproduction Steps

The crash happened only once randomly

Additional Information/Context

hs_err_pid49030.log

Async-profiler version

latest

Environment details

macOS ARM
Java: 17.0.15-amzn

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions