JDK-8305165 : [8u] ServiceThread::nmethods_do is not called to keep nmethods from being zombied while in the queue
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: openjdk8u352
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-03-29
  • Updated: 2023-05-02
  • Resolved: 2023-04-25
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
openjdk8u382 b01Fixed
Related Reports
Relates :  
Description
Crashes in JvmtiExport::post_compiled_method_load were found in JDK8 of our production environment after one day when users started to receive the JVMTI COMPILED_METHOD_LOAD event.

This issue behaved similarly to JDK-8173361.
After debugging, ServiceThread::nmethods_do backported by JDK-8173361 is not called.
JavaThread::nmethods_do should be a virtual function just like 11u or later, otherwise, the following routine cannot call the correct nmethods_do for ServiceThread.
    ALL_JAVA_THREADS(p) {
        p->nmethods_do(cf);
    }

Because this issue cannot be easily reproduced, manually adding some delay on purpose in ServiceThread::service_thread_entry to keep more events pending in JvmtiDeferredEventQueue could help reproduce this issue.
After the fix, various crashes were gone.
Comments
Changeset: 3147b1ba Author: Joshua Zhu <jzhu@openjdk.org> Committer: Paul Hohensee <phh@openjdk.org> Date: 2023-04-25 19:51:50 +0000 URL: https://git.openjdk.org/jdk8u/commit/3147b1bafe12326a97269655de46f066931f3ee4
02-05-2023

Changeset: 3147b1ba Author: Joshua Zhu <jzhu@openjdk.org> Committer: Paul Hohensee <phh@openjdk.org> Date: 2023-04-25 19:51:50 +0000 URL: https://git.openjdk.org/jdk8u-dev/commit/3147b1bafe12326a97269655de46f066931f3ee4
25-04-2023

JDK-8074553 does indeed fix the problem with nmethods_do(). This PR also makes oops_do() virtual (done sometime during JDK 9, it's in the jdk9u repo), which wasn't discussed and imo should be the subject of a backport of the commit that introduced it.
24-04-2023

[~phh] It was an attempt to document that fact why this would need an 8u specific bug (this one). However, on second thought, if a JDK-8074553 backport fixes the problem as well, then that would be my preference.
24-04-2023

Severin, does that mean you'd prefer to have JDK-8074553 backported instead?
24-04-2023

In JDK 9+ the nmethods_do() got declared virtual with JDK-8074553
24-04-2023

Add "jdk8u-fix-request" label again. Please let me know if any issues.
23-04-2023

Fix request: [8u] The issue only exists in 8u. See details in Description. The fix aligns with JDK 11 to make a virtual function call to nmethods_do of JavaThread. Passed GitHub CI and hotspot_tier1 after the fix. Risk: low Review: https://github.com/openjdk/jdk8u-dev/pull/293
23-04-2023

[~jzhu] Please fill in a description of the bug with some explanation as to why this is an 8u-only bug, how to reproduce, etc. Also, for fix approvals provide a risk assessment and the testing you've done in a "Fix Request" comment. Removing the fix request label in the interim.
19-04-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk8u-dev/pull/293 Date: 2023-03-29 09:54:09 +0000
29-03-2023