JDK-8309599 : WeakHandle and OopHandle release should clear obj pointer
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-07
  • Updated: 2023-10-05
  • Resolved: 2023-09-28
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 22
22 b18Fixed
Related Reports
Relates :  
Description
They clear the handle but not the pointer.  They should clear the pointer too so you can test whether the handle is released in some cases.

inline void OopHandle::release(OopStorage* storage) {
  if (_obj != nullptr) {
    // Clear the OopHandle first
    NativeAccess<>::oop_store(_obj, nullptr);
    storage->release(_obj);
  }
} 

Comments
Changeset: 0c55887b Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2023-09-28 12:00:20 +0000 URL: https://git.openjdk.org/jdk/commit/0c55887bfb131501a26ba431919d94f2ba08a6c1
28-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15920 Date: 2023-09-26 12:47:42 +0000
26-09-2023

https://github.com/openjdk/jdk/pull/11296#discussion_r1220212866 This RFE came from this PR discussion.
21-09-2023