On Wed, 28 Sep 2022 15:36:04 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:
>> Please review this patch that makes sure KeepAliveCache does not block all >> threads while closing sockets. >> >> Changes: >> - get operation no longer closes sockets; if there's no socket that is >> recent enough, get returns null and lets the cleaner thread close the sockets >> - put operation closes sockets without holding the cache lock. Additionally, >> if the cache is full, it places the new connection in the cache and removes >> the oldest connection. >> - the cleaner thread creates a list of connections to close, and then closes >> them after releasing the cache lock >> - additionally, we set the socket timeout to 1 millisecond before calling >> socket.close >> >> The new test fails with `Wait for second request timed out` without this >> patch, passes after the changes. Tiers 1-3 clean. > > Daniel Jeliński has updated the pull request incrementally with two > additional commits since the last revision: > > - Close connections in finally block > - Fix copyright year src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java line 125: > 123: @SuppressWarnings("removal") > 124: public void put(final URL url, Object obj, HttpClient http) { > 125: HttpClient oldClient = null; Could you put a comment in there explaining what oldClient is exactly? Eg that it is a client that ends up being closed, either from the cache to make way for the newest entry or if the current client needs to be closed. ------------- PR: https://git.openjdk.org/jdk/pull/10401