Alan Bateman Alan.Bateman at oracle.com
Sun May 15 05:28:01 UTC 2022

On 13/05/2022 18:41, Cay Horstmann wrote:
> I re-read the section on the jdk.tracePinnedThreads sysprop in
> https://openjdk.java.net/jeps/425:
> "The system property jdk.tracePinnedThreads triggers a stack trace 
> when a thread blocks while pinned."
> I interpreted this to expect a stack trace whenever a thread blocks 
> while pinned.
> Since that's not been my experience, I ran a simple program that 
> spawned ten virtual threads, each acquiring the same monitor. With 
> -Djdk.tracePinnedThreads=full, I got one stack trace and not ten. Of 
> course, one is enough, so I guessed this is by design. And then I 
> discovered java.lang.PinnedThreadPrinter.
> It might be good to clarify the JEP. "Recently seen duplicates are not 
> printed."

The system property jdk.tracePinnedThreads is somewhat rudimentary but 
it does attempt to suppress duplicate stack traces. In your example it  
might be annoying to have the same stack trace printed 10 times. TBD 
where this system property will be documented but it will need to make 
it clear that duplicates are suppressed. We can look at making this 
clearer in the JEP too.


More information about the loom-dev mailing list