JDK-8252902 : Handshakes and locking improvements
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2020-09-08
  • Updated: 2021-06-24
  • Resolved: 2021-06-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Relates :  
Description
In some scenarios when using handshakes is favored there is locking mechanism (most common a Mutex) involved.
Many of the Mutexes require that we do safepoint check before locking it. This have two problems:
* The handshake state is protected (as of now with a semaphore) we can thus deadlock if locking order is not correct.
(As part of "8238761: Asynchronous handshakes" this changed to a Mutex)
* Safepointing inside a handshake break the assumption that per thread resources are safe inside the handshake, since they are also safe to modify inside a safepoint. If the JavaThread stops for a safepoint in a handshake any such per thread resource may have changed after the safepoint but while still in the handshake.

One train of thought is to add a NoSafepointVerifyer, and thus make sure we do not block or transition inside the handshake.
(as of now safepoint checking is not allowed/untested but not enforced)

The other train is to instead is to allow it and make sure it works.
Comments
I guess we can close.
10-05-2021

There is currently a NoSafepointVerifier inside the handshake, which seems like the safest thing to do. Is this still an issue?
07-05-2021