# How Async-Profiler's crash handler works

DevFeed: [How Async-Profiler's crash handler works](<https://devfeed.tech/articles/how-async-profiler-s-crash-handler-works-25637.md>)

Original publisher: [Read original article](<https://richardstartin.github.io/posts/async-profiler-crash-handler>)

Author: Richard Startin's Blog

Published: 2023-11-12T00:00:00Z

Content type: article

Language: en

Sources: [Richard Startin's Blog](<https://devfeed.tech/sources/richard-startin-s-blog.md>)

Topics: [async](<https://devfeed.tech/topics/async.md>), [c/c++](<https://devfeed.tech/topics/c-c-plus-plus.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Java](<https://devfeed.tech/topics/java.md>), [JIT](<https://devfeed.tech/topics/jit.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [crash](<https://devfeed.tech/tags/crash.md>), [handler](<https://devfeed.tech/tags/handler.md>), [jit](<https://devfeed.tech/tags/jit.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [run](<https://devfeed.tech/tags/run.md>), [safety](<https://devfeed.tech/tags/safety.md>), [signal](<https://devfeed.tech/tags/signal.md>)

## AI overview

This article explains how async-profiler uses Linux signals and signal handlers to inspect thread state and safely dereference arbitrary pointers without crashing the JVM. It introduces signal-based sampling and frame-pointer unwinding, including the role of JIT-compiled code.

## Source excerpt

Raw pointers in C/C++ open up entire classes of error that are practically unimaginable in higher level languages. So why does anybody use them at all? Unfortunately, it's impossible to write a profiler without getting close to some of the sharp edges of unsafe memory. The async-profiler code base contains a lot of low level tricks, and it's worth studying how some of them work.