From 06b47b1ac6d83d738acd8f89f41d9d30d423072b Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:59:09 +0900 Subject: [PATCH] Note about potential deadlock with virtual threads (#1448) Closes #1440 --- brave/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/brave/README.md b/brave/README.md index efdf8cec50..49e1d3f10d 100644 --- a/brave/README.md +++ b/brave/README.md @@ -948,6 +948,10 @@ Tracing brave4 = Tracing.newBuilder()...build(); Brave brave3 = TracerAdapter.newBrave(brave4.tracer()); ``` +## Virtual threads + +Virtual threads were added in Java 21 via [JEP 444](https://openjdk.org/jeps/444). While the Brave code makes no special consideration for virtual threads, you can generally use Brave with virtual threads. Prior to Java 24, which integrated [JEP 491](https://openjdk.org/jeps/491), it was possible for a deadlock to occur with specific conditions when finishing `Span`s and `ScopedSpan`s on virtual threads - see [#1440](https://github.com/openzipkin/brave/issues/1440). + ### Converting between types Those coding directly to both apis can use `TracerAdapter.toSpan` to navigate between span types. This is useful when working with client RPC