-
Notifications
You must be signed in to change notification settings - Fork 937
Closed
Labels
Description
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
Async-profiler version
latest
Environment details
macOS ARM
Java: 17.0.15-amzn