On Thu, 3 Mar 2022 16:13:37 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> Can I please get a review of this change which proposes to fix the issue > noted in https://bugs.openjdk.java.net/browse/JDK-8282617? > > The `HttpClient` class uses a `inCache` (internal) field to keep track of > whether a connection is in the keep-alive cache. This is a mutable field and > when dealing with this field the `HttpClient` class uses a lock. > > The `HttpsClient` class extends this `HttpClient` class. It additionally > overrides the `putInKeepAliveCache()` method to use a Https specific way of > populating the keep alive cache. While doing so it also reads and updates the > `inCache` `protected` field from its super `HttpClient` class, but doesn't > use a lock to do so. This can thus cause a race condition when the `inCache` > field gets accessed concurrently, for example a separate thread calling the > `HttpClient#isInKeepAliveCache()` method. > > To fix this issue, the commit here uses the same lock/unlock construct used > in the `HttpClient` super class. LGTM ------------- Marked as reviewed by michaelm (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7680