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.

This pull request has now been integrated.

Changeset: 974ef554
Author:    Jaikiran Pai <j...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk/commit/974ef5542fe52f9cb8ffd8751df8a020bca503c9
Stats:     13 lines in 1 file changed: 7 ins; 2 del; 4 mod

8282617: sun.net.www.protocol.https.HttpsClient#putInKeepAliveCache() doesn't 
use a lock while dealing with "inCache" field

Reviewed-by: dfuchs, michaelm

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

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

Reply via email to