ConcurrentHashMap::computeIfAbsent and synchronized
Alan Bateman
Alan.Bateman at oracle.com
Fri Jan 20 19:30:16 UTC 2023
On 20/01/2023 13:17, mikmoila wrote:
> :
>
> If you set the "cpus" to Runtime.getRuntime().availableProcessors() -
> 1 it completes, otherwise it hangs.
>
Right, it effectively deadlocks because one of the virtual threads is
executing the mapping function and is in STS.join waiting for a child
task to complete. The child task can't execute because all carriers are
pinned by other virtual threads trying to execute the same mapping
function. If you generate a thread dump with `jcmd <pid>
Thread.dump_to_file -format=json <file>` it should be easy to see.
-Alan
More information about the loom-dev
mailing list