-
Enhancement
-
Resolution: Fixed
-
P3
-
7, 8, 9, 10
-
b01
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8224198 | openjdk8u222 | Severin Gehwolf | P3 | Resolved | Fixed | b04 |
JDK-8215863 | 8u212 | Prasadarao Koppula | P3 | Resolved | Fixed | b01 |
JDK-8216164 | 8u202 | Prasadarao Koppula | P3 | Resolved | Fixed | b31 |
JDK-8215277 | 8u192 | Prasadarao Koppula | P3 | Closed | Fixed | b35 |
JDK-8221024 | emb-8u211 | Prasadarao Koppula | P3 | Resolved | Fixed | master |
JDK-8219701 | 7u231 | Prasadarao Koppula | P3 | Resolved | Fixed | b01 |
JDK-8221958 | 7u221 | Prasadarao Koppula | P3 | Resolved | Fixed | b31 |
JDK-8220145 | 7u211 | Prasadarao Koppula | P3 | Closed | Fixed | b32 |
JDK-8250727 | openjdk7u | Severin Gehwolf | P3 | Resolved | Fixed | master |
The implementation of hashCode() in sun.security.ssl.SessionId generates many collisions.
The SslEngine of Oracle has an HashMap of SessionId, and because the hashCode generates many collisions the HashMap gets really slow due to the conversion from List to a Tree of a bucket.
This issue was discovered by studying the following stacktrace:
java.lang.Thread.State: RUNNABLE
at java.util.HashMap$TreeNode.find(HashMap.java:1878)
at java.util.HashMap$TreeNode.find(HashMap.java:1874)
at java.util.HashMap$TreeNode.find(HashMap.java:1874)
at java.util.HashMap$TreeNode.find(HashMap.java:1874)
at java.util.HashMap$TreeNode.find(HashMap.java:1874)
at java.util.HashMap$TreeNode.find(HashMap.java:1874)
at java.util.HashMap$TreeNode.getTreeNode(HashMap.java:1886)
at java.util.HashMap.removeNode(HashMap.java:824)
at java.util.HashMap.remove(HashMap.java:799)
at sun.security.util.MemoryCache.emptyQueue(Cache.java:299)
at sun.security.util.MemoryCache.get(Cache.java:386)
The MemoryCache class is synchronised and because the HashMap gets really inefficient, many threads were blocked waiting for this class.
The current hashCode implementation is very inefficient, If you generates 10M random SessionId of 32bytes, you can have more than 10K elements with the same hashCode.
The current implementation sum an array of 32 bytes (maximum), which is very similar to the concept of the "probability of 2 dice": http://statweb.stanford.edu/~susan/courses/s60/split/node65.html
Current SessionId.hashCode() implementation:
for (byte element : a)
result +=element;
A better implementation of the hashCode for a byte array is the one in Arrays.hashCode(byte[]), that for 10M random SessionId of 32byte collides only 2/3 times maximum for the same hashCode.
- backported by
-
JDK-8215863 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8216164 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8219701 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8221024 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8221958 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8224198 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8250727 SessionId.hashCode generates too many collisions
- Resolved
-
JDK-8215277 SessionId.hashCode generates too many collisions
- Closed
-
JDK-8220145 SessionId.hashCode generates too many collisions
- Closed
- duplicates
-
JDK-8218415 JDK 1.7.0_201 Java Monitor Blocked at sun.security.util.MemoryCache.put
- Closed