Restores lost caller stack traces across JVM thread boundaries without production overhead.

java -javaagent:ariadne-agent-0.1.0-beta.1.jar -jar app.jar

Problem & Solution

Standard JVM thread scheduling discards caller frames. Ariadne solves this by recording lightweight pointer chains at dispatch time.

The Problem

Asynchronous Stack Loss in the JVM

When execution transitions across thread boundaries, standard JVM semantics permanently sever caller diagnostics.

  • ✕
    Caller Frame Severance: When a task is submitted to a ThreadPoolExecutor, ForkJoinPool, or reactive scheduler, the worker thread begins execution at runWorker(). The caller call stack is permanently discarded.
  • ✕
    Blind Production Exceptions: Exceptions thrown inside background tasks lack invocation context. It is impossible to determine which controller, event consumer, or user action initiated the failed operation.
  • ✕
    Prohibitive Eager Diagnostics: Workarounds like new Throwable() on every task dispatch or framework assembly tracking impose a 10× to 100× throughput penalty and heavy garbage collection, making them unsafe for production.
The Solution: Ariadne

Lazy Causal Pointer Reconstruction

Ariadne preserves the causal execution graph with single-digit nanosecond allocation and zero happy-path heap retention.

  • ✓
    40-Byte Causal Pointers: At task dispatch, Ariadne captures an immutable reference link pointing to the caller frame. Link allocation consumes exactly 40 bytes in Eden space with Compressed OOPs enabled (HotSpot 64-bit alignment).
  • ✓
    Zero-Cost Happy Path: Successful executions never capture stack traces, format strings, or allocate StackTraceElement arrays (0 bytes retained GC overhead).
  • ✓
    Lazy Stack Synthesis on Failure: Only when an unhandled exception occurs does Ariadne traverse the pointer chain backwards, appending an AsyncCausalityException with full call-site provenance via Throwable.addSuppressed().
  • ✓
    Zero-Code Java Agent: Bytecode instrumentation intercepts thread pools, CompletableFuture, Virtual Threads, and reactive streams transparently at startup without code changes.
Operational Safety

Total Fail-Safe & Kill Switch

Every advice and reconstructor block is bulletproofed with complete exception shielding. A master runtime kill switch (-Dariadne.enabled=false) and package exclusion list ensure risk-free operations.

Security & Privacy

Data Leakage Prevention

MDC diagnostic attachments in exception messages are disabled by default with strict key allowlisting (ariadne.mdc.allowlist) to prevent tokens, credentials, or PII from leaking to log aggregators.

Bounded Memory

Origin-Preserving Window

Memory is strictly bounded to O(maxDepth). When pruning long-lived or recursive chains, Ariadne guarantees that the root ingress origin (e.g., HTTP controller) is permanently preserved alongside immediate failure context.

Architecture

Traditional tools capture complete Throwables on every task, causing 10×–100× throughput degradation. Ariadne records lightweight pointer chains during scheduling and synthesizes stack frames only upon failure.

Step 1: Origin
Caller Thread
OrderService:27
→
40-Byte Link
Link #1 (Parent: null)
< 4 ns • TLAB
→
Step 2: Dispatch
ThreadPool / CompletableFuture
PaymentService:16
→
Context Propagation
Link #2 (Parent: #1)
MDC Context
→
Step 3: Crash Site
Worker Thread
PaymentService:18
Normal Path (99.9%+)
Zero Throwables captured. Pointers are collected in Eden space by the JVM garbage collector without entering Old Gen.
On Failure (<0.1%)
Ariadne traverses Link #2 ➔ Link #1 backwards and attaches an AsyncCausalityException via addSuppressed().
~2 ns
Context Read Latency
Reads active thread link at CPU L1 cache speed (0 B).
< 4 ns
Link Allocation Cost
Exactly 40 bytes (TLAB allocation, Compressed OOPs).
~230 B
Per-Hop Allocation
End-to-end async hop total (Link + execution wrapper + JDK task).
0 B
Cached Site Lookup
Zero steady-state allocation via lock-free descriptor cache.

Benchmarks

Standardized JMH 1.37 benchmarks on Linux x86_64 (OpenJDK 21.0.2 LTS, 5 warmup + 5 measurement iterations, compiler blackholes active, -prof gc).

Asynchronous CompletableFuture Pipeline Latency
CompletableFuture Multi-Hop Chain Execution (JMH Benchmark)
Baseline (No Tracking) 18.42 µs / op (368.0 B)
Ariadne Wrapped Pipeline 18.69 µs / op (536.3 B)

OS thread scheduling and context switching dominate absolute latency (~18 µs). Ariadne wrapping adds only +0.27 µs (+1.4%), allocating just 536 B across the full pipeline.

Project Reactor (Mono & Flux Schedulers)
Asynchronous Hop Latency & Memory Footprint (JMH Benchmark)
Baseline (No Tracking) 18.85 µs (392.0 B)
Ariadne Hooks (Reactor) 19.13 µs (488.0 B) — +1.5% delta
Reactor Hooks.onOperatorDebug() 21.32 µs (2848.1 B) — ~5.8x memory

Rigorous claim: Ariadne incurs only +1.5% overhead on Mono and +1.2% on Flux stream hops, with ~5.8x less allocation than native Hooks.onOperatorDebug().

In-Process Causality vs. OpenTelemetry Tracing
Per-hop Context Allocation & Latency Cost (JMH Microbenchmark)
Ariadne Context Hop (spawn) 8.16 ns / 40.0 B alloc
OpenTelemetry Span (start + end) 115.62 ns / 368.0 B alloc

Ariadne is 14.2x faster with 9.2x less memory allocation per trace node. Stack traces synthesized only on error, avoiding span telemetry pipelines.

Ariadne JMH Benchmark Measurements (OpenJDK 21 HotSpot, -prof gc)

Benchmark Operation Mode / Param Score (Latency) Error (99.9%) Memory Allocation
contextReadCurrent-1.427 ns/op± 0.0220.0 B/op
cachedSiteRegistryLookup-1.245 ns/op± 0.0160.0 B/op
directLinkAllocation-1.547 ns/op± 0.04840.0 B/op
contextSpawn-7.047 ns/op± 0.06440.0 B/op
callSiteResolutionClassMode-5.286 ns/op± 0.1330.0 B/op
contextAttachAndScope-10.283 ns/op± 0.1300.0 B/op
callSiteResolutionSampledMode-21.107 ns/op± 0.52010.1 B/op
synchronousCallableWrapAndCall-13.273 ns/op± 0.62524.0 B/op
synchronousRunnableWrapAndRun-15.171 ns/op± 3.54224.0 B/op
callSiteResolutionFullMode-1320.257 ns/op± 41.0071000.0 B/op
completableFutureSingleHopWrapped-18.836 µs/op± 0.483216.0 B/op
completableFutureSingleHopBaseline-18.995 µs/op± 0.656160.1 B/op
completableFutureMultiHopWrapped-18.689 µs/op± 0.343536.3 B/op
completableFutureMultiHopBaseline-18.415 µs/op± 0.497368.0 B/op
agentInstrumentedCompletableFutureAsync-19.600 µs/op± 0.765328.9 B/op
agentInstrumentedCompletableFutureMultiHop-19.027 µs/op± 0.384856.7 B/op
agentInstrumentedThreadPoolSubmit-19.184 µs/op± 0.755248.8 B/op
platformPoolAriadneWrapped-19.516 µs/op± 0.888168.1 B/op
platformPoolBaseline-19.049 µs/op± 0.849112.1 B/op
virtualThreadAriadneWrapped-18.068 µs/op± 0.582624.1 B/op
virtualThreadBaseline-17.551 µs/op± 0.698368.1 B/op
monoAsyncHopARIADNE19.131 µs/op± 0.541488.0 B/op
monoAsyncHopBASELINE18.847 µs/op± 0.544392.0 B/op
monoAsyncHopOPERATOR_DEBUG21.323 µs/op± 0.6752848.1 B/op
monoMultiHopChainARIADNE38.890 µs/op± 1.4211264.3 B/op
monoMultiHopChainBASELINE38.928 µs/op± 1.337976.3 B/op
monoMultiHopChainOPERATOR_DEBUG45.113 µs/op± 2.3456728.3 B/op
fluxStreamAsyncHopARIADNE20.867 µs/op± 0.8153864.1 B/op
fluxStreamAsyncHopBASELINE20.624 µs/op± 0.6973768.1 B/op
fluxStreamAsyncHopOPERATOR_DEBUG24.285 µs/op± 0.8597064.4 B/op
View Benchmark Workflow on GitHub Actions → Explore Detailed JMH & Load Benchmark Data in Wiki →

How to setup

Zero code modifications required when launched via the Java Agent, or integrate programmatically via Maven or Gradle.

Releases

Targeted and verified on Java 21 LTS (OpenJDK, Eclipse Temurin, and GraalVM).

Version Status Key Enhancements Artifacts Commit
v0.1.0-beta.1 Latest First Beta Release: W3C TraceContext Level 1 propagation, OpenTelemetry reflection bridge, Kotlin Coroutines ThreadContextElement adapter, JDK 21 Scoped Values carrier, and hardened Bootstrap ClassLoader injection. Download JARs Beta 1
v0.1.0-alpha.3 Archive Call Site Resolution Modes, hardened Executor & Thread Advice, Technical Wiki, MDC bootstrap carrier hardening, and SpotBugs false-positive exclusions. Download JARs 816bc55
v0.1.0-alpha.2 Archive SLF4J MDC Context Propagation Adapter, Canary Probes, JMH Benchmark Suite, and JMX MBean Observability. Download JARs 0b608a4
v0.1.0-alpha.1 Archive Initial core engine, ByteBuddy Java agent, Reactor & RxJava adapters, JMX management. Download JARs 5660c72