-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b03
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8341259 | 21.0.6 | Ben Taylor | P4 | Resolved | Fixed | b01 |
If the archived heap object graphs points to any objects that may be reinitialized at run time, the JVM may behave incorrectly. CDSHeapVerifier tries to detect this kind of error. For an explanation, see
https://github.com/openjdk/jdk/blob/3d9d353edb64dd364925481d7b7c8822beeaa117/src/hotspot/share/cds/cdsHeapVerifier.cpp#L40-L65
However, cdsHeapVerifier's handling for interned strings is too strict for cases like this:
******
At dumptime, FooBar is initialized, and its static field points to something like this:
class FooBar {
static final String xxx = System.getProperty("foo") == null ? "AAA" : "BBB"
}
The strings "AAA" and "BBB" are archived as part of the interned string table.
None of the archived object graphs actually point to "AAA" or "BBB". (Note: the static fields of FooBar itself are not archived). So we don't have a condition that cdsHeapVerifier is trying to find.
*******
However, in this case, cdsHeapVerifier still reports an error, even
[3.582s][warning][cds,heap] Field: FooBar::xxx
[3.582s][warning][cds,heap] Value: java.lang.String
[3.582s][warning][cds,heap] {0x000000060e8be8d0} - klass: 'java/lang/String'
[3.582s][warning][cds,heap] - string: "AAA"
[3.582s][warning][cds,heap] - ---- fields (total size 3 words):
[3.582s][warning][cds,heap] - private 'hash' 'I' @12 0 (0x00000000)
[3.582s][warning][cds,heap] - private final 'coder' 'B' @16 0 (0x00)
[3.582s][warning][cds,heap] - private 'hashIsZero' 'Z' @17 true (0x01)
[3.582s][warning][cds,heap] - injected 'flags' 'B' @18 1 (0x01)
[3.582s][warning][cds,heap] - private final 'value' '[B' @20 [B{0x000000060e8be8e8} (0xc1d17d1d)
[3.582s][warning][cds,heap] --- trace begin ---
[3.582s][warning][cds,heap] [ 0] (shared string table)
[3.582s][warning][cds,heap] [ 1] {0x000000060e8be8d0} java.lang.String
[3.582s][warning][cds,heap] --- trace end ---
https://github.com/openjdk/jdk/blob/3d9d353edb64dd364925481d7b7c8822beeaa117/src/hotspot/share/cds/cdsHeapVerifier.cpp#L40-L65
However, cdsHeapVerifier's handling for interned strings is too strict for cases like this:
******
At dumptime, FooBar is initialized, and its static field points to something like this:
class FooBar {
static final String xxx = System.getProperty("foo") == null ? "AAA" : "BBB"
}
The strings "AAA" and "BBB" are archived as part of the interned string table.
None of the archived object graphs actually point to "AAA" or "BBB". (Note: the static fields of FooBar itself are not archived). So we don't have a condition that cdsHeapVerifier is trying to find.
*******
However, in this case, cdsHeapVerifier still reports an error, even
[3.582s][warning][cds,heap] Field: FooBar::xxx
[3.582s][warning][cds,heap] Value: java.lang.String
[3.582s][warning][cds,heap] {0x000000060e8be8d0} - klass: 'java/lang/String'
[3.582s][warning][cds,heap] - string: "AAA"
[3.582s][warning][cds,heap] - ---- fields (total size 3 words):
[3.582s][warning][cds,heap] - private 'hash' 'I' @12 0 (0x00000000)
[3.582s][warning][cds,heap] - private final 'coder' 'B' @16 0 (0x00)
[3.582s][warning][cds,heap] - private 'hashIsZero' 'Z' @17 true (0x01)
[3.582s][warning][cds,heap] - injected 'flags' 'B' @18 1 (0x01)
[3.582s][warning][cds,heap] - private final 'value' '[B' @20 [B{0x000000060e8be8e8} (0xc1d17d1d)
[3.582s][warning][cds,heap] --- trace begin ---
[3.582s][warning][cds,heap] [ 0] (shared string table)
[3.582s][warning][cds,heap] [ 1] {0x000000060e8be8d0} java.lang.String
[3.582s][warning][cds,heap] --- trace end ---
- backported by
-
JDK-8341259 Improve CDSHeapVerifier in handling of interned strings
-
- Resolved
-
- relates to
-
JDK-8321206 Make Locale related system properties `StaticProperty`
-
- Resolved
-
- links to
-
Commit openjdk/jdk/4f3de096
-
Commit(master) openjdk/jdk21u-dev/0943249c
-
Review openjdk/jdk/17102
-
Review(master) openjdk/jdk21u-dev/925
(1 links to)