Menu
OpenJDK considers async stack traces for Java

OpenJDK considers async stack traces for Java

Proposal would define an API to collect stack traces asynchronously and include information on both Java and native stack frames.

Credit: Dreamstime

A proposal promoting asynchronous stack traces in Java is advancing through the OpenJDK's Java enhancement process.

The plan, Asynchronous Stack Trace VM API, would define an AsyncGetStackTrace API to collect stack traces asynchronously and include data on both Java and native stack frames.

Goals of the effort include provision of a well-tested API for profilers, which would obtain the Java native stack frames information, and support for asynchronous usage, such as calling from signal handlers.

As per the proposal, performance would not be affected when the API is not in use and memory requirements would not be significantly increased compared to the existing AsyncGetCallTrace API. The new API would not be recommended for production use, because it could crash the JVM. Plans call for minimising the chances of that through extensive testing and fuzzing.

Currently, AsyncGetCallTrace is used by most available profilers, both open source and commercial, including async-profiler. But it has two major disadvantages. It is an internal API, not exported in any header, and it only returns information about Java frames, namely their method and bytecode indices.

These issues make implementing profilers and related tools more difficult. Although additional information can be extracted from the HotSpot VM through complex code, other useful information remains hidden, such as whether a compiled Java frame is inlined, the compilation level of a Java frame, and information on C/C++ frames not at the top of the stack.

This data can be helpful for profiling and tuning a VM for a given application and for profiling code that heavily uses JNI (Java Native Interface).

The AsyncGetStackTrace API would be modelled on the AsyncGetCallTrace API. The new API has not yet been proposed for a specific version of standard Java. The next version of Java is Java Development Kit (JDK) 20, which is expected in March 2023.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags javaOpenJDK

Events

SustainTech

Join key decision-makers within Environmental, Social, and Governance (ESG) that have the power to affect real change and drive sustainable practices. SustainTech will bridge the gap between ambition and tangible action, promoting strategies that attendees can use in their day-to-day operations within their business.

EDGE 2023

EDGE is the leading technology conference for business leaders in Australia and New Zealand, built on the foundations of collaboration, education and advancement.

WIICTA 2023

ARN has celebrated gender diversity and recognised female excellence across the Australian tech channel since first launching WIICTA in 2012, acknowledging the achievements of a talented group of female front runners who have become influential figures across the local industry.

ARN Innovation Awards 2023

Innovation Awards is the market-leading awards program for celebrating ecosystem innovation and excellence across the technology sector in Australia.

Show Comments