RFR: 8304174: Remove delays from httpserver tests

Daniel Jeliński djelinski at openjdk.org
Wed Mar 15 19:12:22 UTC 2023


On Tue, 14 Mar 2023 19:41:25 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> This change improves the running time of many httpserver tests; it removes the one second delay introduced by `delay()` calls, and performs immediate httpserver stop by calling `stop(0)`.
> 
> For example, `com/sun/net/httpserver/Test1.java` usually takes 20-30 seconds without this change; with this change it completes in 5-8 seconds.
> 
> Tiers 1-3 still green.

Thanks for your comments!
In most of the tests, all requests are done when we stop the server.
I checked the `HttpServerTest`; moved `serverStopped.await();` before `is.readAllBytes();` to make sure the wrong side wins the race. The test still passed.
If the tests start failing, we will fix the races using the proper synchronization objects like `CountDownLatch`. For now, after 50 reps of `com/sun/net/httpserver` tests I have zero failures.

I plan to revisit `HttpServer::stop` in [JDK-8304065](https://bugs.openjdk.org/browse/JDK-8304065). However, even when implemented correctly, `stop(1)` will be slightly slower than `stop(0)`.

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

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


More information about the net-dev mailing list