See [https://hibernate.atlassian.net/browse/HHH-15541|https://hibernate.atlassian.net/browse/HHH-15541|smart-link], apparently some synchronized blocks cause problems with Loom by “pinning threads”.
What that means exactly is secondary, I think; the important part is that migrating from synchronized blocks to locks should be trivial, so we might as well do it.
So, let’s remove the problematic synchronized blocks from non-test code, and use locks instead.
WARNING: I’m not sure which synchronized blocks are problematic exactly, it would seem that some {{synchronized}} uses are fine (such as the {{synchronized}} modifier on a method, and _maybe_ {{synchronized(this)}} inside a method) while others are definitely problematic ({{synchronized(someOtherObject)}}). See [https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/Loom.20.28virtual.20threads.29.20support/near/302527116|https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/Loom.20.28virtual.20threads.29.20support/near/302527116] . We'll need some research to determine precise rules.
Also, while we’re at it, we should probably add a checkstyle rule to forbid problematic synchronized blocks (and suggest using locks instead, with a link to this ticket). |
|