JDK-8271348 : Add stronger sanity check of thread state when polling for safepoint/handshakes
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-07-27
  • Updated: 2021-08-05
  • Resolved: 2021-08-02
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.
JDK 18
18 b09Fixed
Related Reports
Blocks :  
Relates :  
Description
SafepointSynchronize::block() checks the _thread_state of the JT and exits with fatal error if the state is not valid. The JT could have the wrong state when checking for safepoint/handshakes but due to timing issues we might not notice it, i.e. there are no current safepoint operations to block for so we never call SafepointSynchronize::block(). A sanity check of the JT state could be added in SafepointMechanism right before checking for pending safepoint operations and calling SafepointSynchronize::block().
Comments
Changeset: db950ca4 Author: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2021-08-02 16:00:13 +0000 URL: https://git.openjdk.java.net/jdk/commit/db950ca41f3ab7823fa221e8e3f63caf3dd51ea3
02-08-2021

This issue is blocked by JDK-8271251 since we don't want to integrate this RFE until that bug is fixed.
27-07-2021

8271348.cr0.patch - This is the patch from [~pchilanomate] plus the addition of an assert() in block() to catch any new callers of block() with the wrong state. 8271348_linux_jdk17.zip - This is the results from 8271348.cr0.patch applied to a recent JDK17 repo without the fix for JDK-8271251. - The new patch catches the error in the vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java in 'release', 'fastdebug' and 'slowdebug' bits.
27-07-2021