RFR: 8276660: Scalability bottleneck in java.security.Provider.getService() [v2]

Valerie Peng valeriep at openjdk.java.net
Tue Nov 30 20:24:06 UTC 2021


On Mon, 29 Nov 2021 23:24:59 GMT, Weijun Wang <weijun at openjdk.org> wrote:

> Some comments. I'm more concerned about the `parseLegacy()` method which is called everywhere. Without the synchronized keyword, is it safe to call into this method by multiple threads at the same time? Do we have tests around this?

Hmm, the parseLegacy() method just processes the key/value legacy String-String mapping into corresponding service object (or its update) and store into the legacy service object (now typed as ConcurrentHashMap). I don't see any particular field which would require the "synchronized" keyword. There is test/jdk/java/security/Provider/GetServiceRace.java testing the legacy put() and getService() race condition. Not sure if it covers the scenarios you have in mind. Under most if not all usages, the legacy put() calls take place in provider constructor, unlike the getService() calls which may be called by different threads.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6513


More information about the security-dev mailing list