-
Bug
-
Resolution: Fixed
-
P4
-
11, 15, 16, 17
-
b09
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8262765 | 16.0.2 | Harold Seigel | P4 | Resolved | Fixed | b01 |
JDK-8262371 | 16.0.1 | Harold Seigel | P4 | Resolved | Fixed | b07 |
JDK-8261446 | 11.0.12-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8261771 | 11.0.11 | Thomas Stuefe | P4 | Resolved | Fixed | b03 |
There is a bug in the report code which causes hash distribution statistics displayed to be widely off:
```
Hash distribution:
1 entry: 179
2 entries: 79
3 entries: 66
4 entries: 72
5 entries: 98
6 entries: 75
7 entries: 55
8 entries: 43
9 entries: 22
10 entries: 16
11 entries: 5
12 entries: 6
```
This is the bucket chain length histogram. Note that the sum of all values is 716 which exceeds the table width of 511, the total number of buckets. Depending on the hash function used, the statistics may be way more off though.
The problem is caused by a bug in the walker code where the bucket index is calculated by manually mod'ing `NativeCallStack::hash()` with table size:
https://github.com/openjdk/jdk/blob/d0a8f2f737cdfc1ae742d47f2dd4f2bbc03f4398/src/hotspot/share/services/memTracker.cpp#L263
which is wrong since the hash is defined as signed int. So it yields incorrect index values if the hash code is <0, compared with the regular hashcode-to-index calculation done in the table itself:
https://github.com/openjdk/jdk/blob/d0a8f2f737cdfc1ae742d47f2dd4f2bbc03f4398/src/hotspot/share/services/mallocSiteTable.hpp#L243
which leads the walker class to reckon that we now enter a different bucket chain and closes the former bucket chain off. Therefore, in the end, we appear to have more chains than table size would allow for.
This is an old bug, in there since almost the start of NMT (
- backported by
-
JDK-8261446 NMT: tuning statistic shows incorrect hash distribution
- Resolved
-
JDK-8261771 NMT: tuning statistic shows incorrect hash distribution
- Resolved
-
JDK-8262371 NMT: tuning statistic shows incorrect hash distribution
- Resolved
-
JDK-8262765 NMT: tuning statistic shows incorrect hash distribution
- Resolved
- relates to
-
JDK-8046598 Scalable Native Memory Tracking development
- Resolved
-
JDK-8261297 NMT: Final report should use scale 1
- Resolved
-
JDK-8261302 NMT: Improve malloc site table hashing
- Resolved
- links to
-
Commit openjdk/jdk16u/9fa0e03d
-
Commit openjdk/jdk/20d7713c
-
Review openjdk/jdk16u/42
-
Review openjdk/jdk/2458