On Thu, 4 Aug 2022 20:41:33 GMT, Michael McMahon <micha...@openjdk.org> wrote:
> Hi, > > Some new keep alive tests are exposing some old bugs. In this case if the > server sends an invalid timeout (say -20 seconds) we accept it creating a > timeout in the past. So, the first time the keep alive thread wakes up it > will close the connection. > The correct behavior is to ignore the invalid parameter and fallback to the > default timeout or the timeout set by the relevant system property. > > Thanks, > Michael src/java.base/share/classes/sun/net/www/http/HttpClient.java line 902: > 900: responses.findValue("Keep-Alive")); > 901: /* default should be larger in case of proxy */ > 902: keepAliveConnections = p.findInt("max", > usingProxy?50:5); Hello Michael, should we do something similar for this `max` parameter value too and (re)set the `keepAliveConnections` to the defaults, if the server sends a negative value? test/jdk/sun/net/www/http/KeepAliveCache/B8291637.java line 27: > 25: * @test > 26: * @bug 8291637 > 27: * @run main/othervm -Dhttp.keepAlive.time.server=20 -esa -ea B8291637 Is it intentional that we are setting the -esa and -ea options here? test/jdk/sun/net/www/http/KeepAliveCache/B8291637.java line 103: > 101: } > 102: } catch (IOException e) { > 103: System.err.println("Server exception terminating"); It looks to me that if an exception occurs (not just `IOException`) then this test might hang (and timeout with the jtreg timeout) at the `passed.get()` call in the `main()` method. Should we perhaps catch `Throwable` here and do `passed.completeExceptionally`? ------------- PR: https://git.openjdk.org/jdk/pull/9755