Real-world Pinning/ReentrantLock deadlock

Danny Thomas dannyt at netflix.com
Tue Jun 25 01:13:37 UTC 2024


Hi folks,

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:

https://gist.github.com/DanielThomas/dddd850f7e491cac3a2dd734978f4267

Looking forward to the locking improvements!

Cheers,
Danny

[1]
https://github.com/openzipkin/zipkin-reporter-java/blob/519133204bc5a56a5286c6f40facc10c76270b5f/core/src/main/java/zipkin2/reporter/internal/CountBoundedQueue.java#L71-L93
[2]
https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealSpan.java#L132-L136
[3]
https://github.com/openzipkin/brave/blob/69003dfc811418f0dbc42e9e17ff880ebe1f4b02/brave/src/main/java/brave/RealScopedSpan.java#L62-L65
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20240625/eec55c96/attachment.htm>


More information about the loom-dev mailing list