On Wed, 27 Mar 2024 01:02:41 GMT, Andrei Pangin <apan...@openjdk.org> wrote:

> This fix makes `AsyncGetCallTrace` reentrant and async-signal-safe.
> Reentrancy is required in the cases when two or more profiling engines are 
> running at the same time, e.g., when CPU and Wall clock profilers work 
> together and therefore one profiler may interrupt another in the middle of 
> getting a stack trace.
> 
> Tested with async-profiler:
> 
> java 
> -agentpath:/path/to/libasyncProfiler.so=start,event=cpu,interval=1ms,wall=1ms,file=profile.jfr

Marked as reviewed by sspitsyn (Reviewer).

src/hotspot/share/runtime/thread.hpp line 664:

> 662:   ThreadInAsgct(Thread* thread) : _thread(thread) {
> 663:     assert(thread != nullptr, "invariant");
> 664:     // AsyncGetCallTrace is reentrant - save the previous state.

Nit: It is possible to rephrase this comment as follows:

  // Allow AsyncGetCallTrace to be reentrant - save the previous state.
``

-------------

PR Review: https://git.openjdk.org/jdk/pull/18504#pullrequestreview-1967889766
PR Review Comment: https://git.openjdk.org/jdk/pull/18504#discussion_r1544102770

Reply via email to