<div dir="ltr">Hi folks,<div><br></div><div>We ran into a real-world deadlock with virtual threads and Micrometer, Brave/Zipkin. In short, there are two paths to CountBoundedQueue.offer[1] for finishing a span. RealSpan.finish[2] has a synchronized block, RealScopedSpan.finish[3] doesn't. If a virtual thread using RealScopedSpan is next line for the lock, but all carriers are currently occupied by pinned VTs in RealSpan.finish, the application will deadlock:<br><br><a href="https://gist.github.com/DanielThomas/dddd850f7e491cac3a2dd734978f4267">https://gist.github.com/DanielThomas/dddd850f7e491cac3a2dd734978f4267</a><br></div><div><br></div><div>Looking forward to the locking improvements!</div><div><br></div><div>Cheers,<br>Danny<br><br></div><div>[1] <a href="https://github.com/openzipkin/zipkin-reporter-java/blob/519133204bc5a56a5286c6f40facc10c76270b5f/core/src/main/java/zipkin2/reporter/internal/CountBoundedQueue.java#L71-L93">https://github.com/openzipkin/zipkin-reporter-java/blob/519133204bc5a56a5286c6f40facc10c76270b5f/core/src/main/java/zipkin2/reporter/internal/CountBoundedQueue.java#L71-L93</a><br>[2]  <a href="https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealSpan.java#L132-L136">https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealSpan.java#L132-L136</a><br>[3] <a href="https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealScopedSpan.java#L62-L65">https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealScopedSpan.java#L62-L65</a></div><div><br></div></div>