RFR: 8223783: sun/net/www/http/HttpClient/MultiThreadTest.java sometimes detect threads+1 connections [v7]
Daniel Fuchs
dfuchs at openjdk.org
Thu Nov 24 11:53:11 UTC 2022
> Please find here a test fix for the sun/net/www/http/HttpClient/MultiThreadTest.
>
> This test makes concurrent connections to a server using multiple threads, and due to keep-alive, expects that there should not be more connections than concurrent threads. However, the test has been seen occasionally and intermittently failing because it observed more connections than threads. The test has some built-in logic to exclude connections that do not come from the test itself, so external interference should not be the cause.
>
> The suspicion is that occasionally some connection might remain idle for more than the keep-alive timeout, which then causes it to be closed, and allows the client to open a new connection.
>
> This fix works this way:
>
> - first it adds some logic to figure out whether a Worker thread might have remained idle for more than the keep-alive timeout
> - then it takes this information into account when matching the number of actual connections with the number of expected connection,
> - additionally it reduces the keep-alive timeout to one second, and forces some sleep on the client side after half the requests have been sent to increase the probability that some connections will be idle long enough to trigger the idle-time detection logic (as a means to test the fix itself).
>
> Finally it improves logging by adding more diagnosis (including human readable time stamps), so that future failures, if any, will be easier to diagnose. Note that reducing the keep-alive time to 1 second makes the test run much faster even with the 1500ms sleep on the client side.
>
> With this fix I no longer observe the test failing.
Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:
- Merge branch 'master' into MultiThreadTest-8223783
- Add a comment
- Use the tests list to simplify the logic of waiting for clients to finish
- Incorporated review feedback
- Incorporated review feedback
- Merge branch 'master' into MultiThreadTest-8223783
- Update test/jdk/sun/net/www/http/HttpClient/MultiThreadTest.java
Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
- Update test/jdk/sun/net/www/http/HttpClient/MultiThreadTest.java
Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
- 8223783
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11268/files
- new: https://git.openjdk.org/jdk/pull/11268/files/7b66e0b8..c5c13325
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11268&range=06
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11268&range=05-06
Stats: 7285 lines in 154 files changed: 4611 ins; 1815 del; 859 mod
Patch: https://git.openjdk.org/jdk/pull/11268.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11268/head:pull/11268
PR: https://git.openjdk.org/jdk/pull/11268
More information about the net-dev
mailing list