-
Bug
-
Resolution: Fixed
-
P4
-
17, 21, 22
-
b08
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8356674 | 21.0.8 | Satyen Subramaniam | P4 | Resolved | Fixed | b03 |
JDK-8356673 | 17.0.16 | Satyen Subramaniam | P4 | Resolved | Fixed | b03 |
During investigation of a customer core file with graphic SA, it printed in stack memory:
````
Error while performing oopsDo for frame sp: 0x00007f2c602378f0, unextendedSP: 0x00007f2c602378f0, fp: 0x00007f2c60237938, pc: 0x00007f2c47e2b88a
java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.gc.g1.HeapRegion.isFree()" because "region" is null
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.addAnnotation(HSDB.java:1099)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.visitAddress(HSDB.java:1059)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.InterpreterFrameClosure.offsetDo(Frame.java:675)
at jdk.hotspot.agent/sun.jvm.hotspot.interpreter.OopMapCacheEntry.iterateOop(OopMapCacheEntry.java:38)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsInterpretedDo(Frame.java:591)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsDo(Frame.java:442)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34.run(HSDB.java:1052)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.WorkerThread$MainLoop.run(WorkerThread.java:70)
at java.base/java.lang.Thread.run(Thread.java:1570
````
The reproducer is attached.
1. Compile and launch it with G1 enabled.
2. Attach HSDB
3. Select "main" thread
4. Click "Stack Memory" icon on "Java Threads" toolbar.
The fix is trivial (will create PR soon):
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
index 9cc51934d08..e59c3da379e 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
@@ -1096,7 +1096,9 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
G1CollectedHeap heap = (G1CollectedHeap)collHeap;
HeapRegion region = heap.hrm().getByAddress(handle);
- if (region.isFree()) {
+ if (region == null) {
+ anno = "NOTG1REGION";
+ } else if (region.isFree()) {
anno = "Free ";
bad = false;
} else if (region.isYoung()) {
````
Error while performing oopsDo for frame sp: 0x00007f2c602378f0, unextendedSP: 0x00007f2c602378f0, fp: 0x00007f2c60237938, pc: 0x00007f2c47e2b88a
java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.gc.g1.HeapRegion.isFree()" because "region" is null
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.addAnnotation(HSDB.java:1099)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.visitAddress(HSDB.java:1059)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.InterpreterFrameClosure.offsetDo(Frame.java:675)
at jdk.hotspot.agent/sun.jvm.hotspot.interpreter.OopMapCacheEntry.iterateOop(OopMapCacheEntry.java:38)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsInterpretedDo(Frame.java:591)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsDo(Frame.java:442)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34.run(HSDB.java:1052)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.WorkerThread$MainLoop.run(WorkerThread.java:70)
at java.base/java.lang.Thread.run(Thread.java:1570
````
The reproducer is attached.
1. Compile and launch it with G1 enabled.
2. Attach HSDB
3. Select "main" thread
4. Click "Stack Memory" icon on "Java Threads" toolbar.
The fix is trivial (will create PR soon):
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
index 9cc51934d08..e59c3da379e 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
@@ -1096,7 +1096,9 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
G1CollectedHeap heap = (G1CollectedHeap)collHeap;
HeapRegion region = heap.hrm().getByAddress(handle);
- if (region.isFree()) {
+ if (region == null) {
+ anno = "NOTG1REGION";
+ } else if (region.isFree()) {
anno = "Free ";
bad = false;
} else if (region.isYoung()) {
- backported by
-
JDK-8356673 NPE when HSDB visits bad oop
-
- Resolved
-
-
JDK-8356674 NPE when HSDB visits bad oop
-
- Resolved
-
- links to
-
Commit openjdk/jdk/a7427678
-
Commit(master) openjdk/jdk17u-dev/4f7c1267
-
Commit(master) openjdk/jdk21u-dev/42129b33
-
Review openjdk/jdk/14922
-
Review(master) openjdk/jdk17u-dev/3546
-
Review(master) openjdk/jdk21u-dev/1738
(3 links to)