- 
    Bug 
- 
    Resolution: Fixed
- 
     P3 P3
- 
    11, 14
- 
        b16
- 
        generic
- 
        generic
- 
        Verified
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8245804 | 13.0.4 | Paul Hohensee | P3 | Resolved | Fixed | b03 | 
| JDK-8240496 | 11.0.8-oracle | Paul Hohensee | P3 | Resolved | Fixed | b01 | 
| JDK-8239247 | 11.0.7 | Paul Hohensee | P3 | Resolved | Fixed | b04 | 
| JDK-8248958 | 8u271 | Paul Hohensee | P3 | Resolved | Fixed | b01 | 
| JDK-8241195 | 8u261 | Paul Hohensee | P3 | Resolved | Fixed | b01 | 
| JDK-8244013 | 8u251 | Paul Hohensee | P3 | Closed | Fixed | b33 | 
| JDK-8241346 | 8u241 | Paul Hohensee | P3 | Resolved | Fixed | b61 | 
| JDK-8251730 | emb-8u271 | Paul Hohensee | P3 | Resolved | Fixed | team | 
| JDK-8246974 | emb-8u261 | Paul Hohensee | P3 | Resolved | Fixed | team | 
java.security.Provider.getService reads legacyMap at line 1260
http://hg.openjdk.java.net/jdk/jdk/file/08a5148e7c4e/src/java.base/share/classes/java/security/Provider.java#l1276
The read is not synchronized with the clear and repopulate of the same map's entries in java.security.Provider.ensureLegacyParsed. The result is a race condition when more than two threads execute both methods simultaneously. I've attached a reproducer.
The fix is a simpler one liner.
--- old/src/java.base/share/classes/java/security/Provider.java 2019-09-16 15:28:26.000000000 -0700
+++ new/src/java.base/share/classes/java/security/Provider.java 2019-09-16 15:28:25.000000000 -0700
@@ -1255,9 +1255,9 @@
}
synchronized (this) {
ensureLegacyParsed();
- }
- if (legacyMap != null && !legacyMap.isEmpty()) {
- return legacyMap.get(key);
+ if (legacyMap != null && !legacyMap.isEmpty()) {
+ return legacyMap.get(key);
+ }
}
return null;
}
- backported by
- 
                    JDK-8239247 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8240496 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8241195 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8241346 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8245804 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8246974 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8248958 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8251730 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Resolved
 
-         
- 
                    JDK-8244013 java.security.Provider.getService returns random result due to race condition with mutating methods in the same class -           
- Closed
 
-         
- relates to
- 
                    JDK-7092821 java.security.Provider.getService() is synchronized and became scalability bottleneck -           
- Resolved
 
-