< img src ="https://images.idgesg.net/images/article/2018/05/coffee_cup_beans_java_by_christoph_cc0_via_pixabay_1200x800-100758865-large.jpg?auto=webp&quality=85,70"alt=""> 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 gather stack traces asynchronously and include information on both Java and native stack frames. Objectives of the effort include arrangement of a well-tested API for profilers, which would get the Java native stack frames info, and support for asynchronous use, such as calling from signal handlers.As per the proposition, efficiency 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 usage, due to the fact that it could crash the JVM. Strategies require reducing the chances of that through extensive screening and fuzzing.Currently, AsyncGetCallTrace is used by a lot of available profilers, both open source and business, including async-profiler. But it has two significant downsides. It is an internal API, not exported in any header, and it just returns information about Java frames, namely their method andbytecode indices. These concerns make carrying out profilers and related tools harder. Although extra details can be drawn out from the HotSpot VM through complex code, other beneficial details stays covert, such as whether an assembled Java frame is inlined, the collection level of a Java frame, and info on C/C++frames not at the top of the stack. This data can be useful for profiling and tuning a VM for a given application and for profiling code that greatly utilizes JNI (Java Native User Interface). The AsyncGetStackTrace API would be modeled on the AsyncGetCallTrace API. The new API has not yet been proposed for a particular variation of standard Java. The next variation of Java is Java Advancement
Kit (JDK)20, which is anticipated in March 2023. Copyright © 2022 IDG Communications, Inc. Source