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

Guzhenyuan duke at openjdk.org
Mon Jul 25 10:14:00 UTC 2022


On Tue, 30 Nov 2021 23:03:42 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

> > Consider this case, two threads are changing a value at the same time. Since the method is not synchonized, thread1 might finish the first part of the method (`super.replace`) earlier than thread2, but it finishes the second part (`parseLegacy`) later than thread2. At the end, the internal entrySet has thread2's value but the legacy map has thread1's value.
> 
> Well, then the synchronized keyword should be put on the public methods instead of the internal parseLegacy() method, no? Otherwise, the super.xxx() and the internal legacyMap may not updated in sync. The public methods did have the synchronized keywords which I removed since the putService() call isn't synchronized either (and it updates the serviceMap first and then stores the String-String mapping into super.xxx()). The main performance bottleneck is in getService(), so I can add back the "synchronized" keywords to other public methods if you are concerned.

Can you tell me which version of jdk fixes these bugs

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

PR: https://git.openjdk.org/jdk/pull/6513


More information about the security-dev mailing list