From 3f01d03a10cb3f647735ed4bbea1768ff18bf8f2 Mon Sep 17 00:00:00 2001 From: Lin Zang Date: Mon, 11 Oct 2021 15:27:28 +0000 Subject: [PATCH] 8275021: Test serviceability/sa/TestJmapCore.java fails with: java.io.IOException: Stack frame 0x4 not found Reviewed-by: dholmes, dcubed --- .../classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index c8afa4c1b2d..75f27fa5d73 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -615,6 +615,8 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { } else { out.writeByte((byte)HPROF_HEAP_DUMP); out.writeInt(0); + // We must flush all data to the file before reading the current file position. + out.flush(); // record the current position in file, it will be use for calculating the size of written data currentSegmentStart = fos.getChannel().position(); // write dummy zero for length