JDK-8299375 : [PPC64] GetStackTraceSuspendedStressTest tries to deoptimize frame with invalid fp
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20,21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: ppc
  • Submitted: 2022-12-27
  • Updated: 2024-07-10
  • Resolved: 2023-03-17
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 21
21 b15Fixed
Related Reports
Relates :  
Description
Symptom
========

The VM runs into the following assertion:
#  Internal Error (jdk/src/hotspot/cpu/ppc/frame_ppc.inline.hpp:80), pid=32736, tid=32774
#  assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) || is_interpreted_frame()) && is_aligned(_fp, alignment_in_bytes)) failed: invalid alignment ... fp:0xfffffffffffffffe (which matches "badAddress")

Stack:
V  [libjvm.so+0x6976d8]  frame::setup()+0x3b0  (frame_ppc.inline.hpp:80)
V  [libjvm.so+0x6978b8]  frame::frame(long*, unsigned char*, long*, long*, CodeBlob*)+0x9c  (frame_ppc.inline.hpp:97)
V  [libjvm.so+0xac5f34]  frame::patch_pc(Thread*, unsigned char*)+0x45c  (frame_ppc.cpp:266)
V  [libjvm.so+0xab748c]  frame::deoptimize(JavaThread*)+0x228  (frame.cpp:350)
V  [libjvm.so+0x8eedbc]  ThawBase::recurse_thaw_compiled_frame(frame const&, frame&, int, bool)+0x838  (continuationFreezeThaw.cpp:2241)
V  [libjvm.so+0x8ed8b4]  ThawBase::recurse_thaw(frame const&, frame&, int, bool)+0x29c  (continuationFreezeThaw.cpp:2018)
V  [libjvm.so+0x8fe4a8]  bool ThawBase::recurse_thaw_java_frame<ContinuationHelper::InterpretedFrame>(frame&, int)+0x2b4  (continuationFreezeThaw.cpp:2046)
V  [libjvm.so+0x8edf94]  ThawBase::recurse_thaw_interpreted_frame(frame const&, frame&, int)+0xf0  (continuationFreezeThaw.cpp:2135)
V  [libjvm.so+0x8ed8d0]  ThawBase::recurse_thaw(frame const&, frame&, int, bool)+0x2b8  (continuationFreezeThaw.cpp:2020)
V  [libjvm.so+0x8ed4ec]  ThawBase::thaw_slow(stackChunkOopDesc*, bool)+0x2ec  (continuationFreezeThaw.cpp:1994)
V  [libjvm.so+0x90df1c]  Thaw<Config<(oop_kind)0, CardTableBarrierSet> >::thaw(Continuation::thaw_kind)+0x24c  (continuationFreezeThaw.cpp:1788)
V  [libjvm.so+0x904908]  long* thaw_internal<Config<(oop_kind)0, CardTableBarrierSet> >(JavaThread*, Continuation::thaw_kind)+0x3c4  (continuationFreezeThaw.cpp:2392)
V  [libjvm.so+0x9034a0]  Config<(oop_kind)0, CardTableBarrierSet>::thaw(JavaThread*, Continuation::thaw_kind)+0x38  (continuationFreezeThaw.cpp:270)
V  [libjvm.so+0x8f1050]  long* thaw<Config<(oop_kind)0, CardTableBarrierSet> >(JavaThread*, int)+0x74  (continuationFreezeThaw.cpp:247)
v  ~BufferBlob::StubRoutines (3) 0x0000200010376844
J 489 c1 jdk.internal.vm.Continuation.run()V java.base@21-internal (586 bytes) @ 0x0000200010d93084 [0x0000200010d92e80+0x0000000000000204]

Issue is reproducible (not always, but most of the time) with JDK 20 and 21:
make run-test TEST="serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java" JTREG="VM_OPTIONS=-XX:TieredStopAtLevel=1"

JDK-8286302 uses "patch_callee_link(hf, (intptr_t*)badAddress);" which doesn't work for the usage given by the stack trace.

Analysis
========

- The frame that get's deoptimized is not fully initialized.

- The backlink will be initialized later because it is not yet known if the frame will be extended for its callee

- The backlink was set to `badAddress` (0xfffffffffffffffe) when the frame was frozen

- `badAddress` is not 16 byte aligned which causes the assertion

- can be reproduce with the following command
  make test TEST=serviceability/jvmti/stress/StackTrace/Suspended/GetStackTraceSuspendedStressTest.java \
                 TEST_VM_OPTS="-Xcomp -XX:CompileCommand=compileonly,GetStackTraceSuspendedStressTest::*"
Comments
Changeset: 9d518c52 Author: Richard Reingruber <rrich@openjdk.org> Date: 2023-03-17 08:45:17 +0000 URL: https://git.openjdk.org/jdk/commit/9d518c528b11953b556aa7585fc69ff9c9a22435
17-03-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/12941 Date: 2023-03-09 10:46:05 +0000
14-03-2023

Hi Martin, sorry, I should have assigned the ticket to me as I've already started to work on it. I think the problem is that the frame just copied from the heap to the stack is not yet complete (missing backlink) when it gets deoptimized. Unfortunately I haven't been able to reproduce the issue yet. Cheers, Richard.
18-01-2023

Hi [~rrich], I think you wanted to work on this issue. (Correct me if I'm wrong.) I just assigned it to you.
18-01-2023

Hi [~mdoerr], do you intend to work on this or should it be assigned to someone else? (We just try to keep all targeted bugs assigned).
12-01-2023

ILW = Deoptimizing frame with invalid fp in stress test on PPC with C1, only one test and with PPC and intermittent, no workaround = MLH = P4
03-01-2023