RFR: 8255583: Investigate creating a test to trigger the condition in KeepAliveStreamCleaner [v2]

Conor Cleary ccleary at openjdk.java.net
Mon Dec 7 11:39:30 UTC 2020


> The KeepAliveStreamCleaner in sun.net.ww.http package had been previously seen to fail with an IllegalMonitorStateException. This failure was caused by the use of `wait()` in a non synchronized block. This failure was mitigated through use of `await()` instead as is shown below (code can be viewed on L119 in src/java.base/share/classes/sun/net/www/http/KeepAliveStreamCleaner.java).
> 
> ...
> long timeout = TIMEOUT;
>     while ((kace = poll()) == null) {
>             waiter.await(timeout, TimeUnit.MILLISECONDS); 
> ...
> While the code throwing the exception was fixed, a regression test was not made. So this patch adds a simple white-box test which calls the KeepAliveStreamCleaner's run method. `waiter.wait()` should always fail if not used in a synchronized block or method, so the test verifies that it is not used.

Conor Cleary has updated the pull request incrementally with two additional commits since the last revision:

 - 8255583: Added original bug id to bug tag
 - 8255583: Add bug & summary tags to KeepAliveStreamCleanerTestDriver

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1659/files
  - new: https://git.openjdk.java.net/jdk/pull/1659/files/ebbe000e..a6ca8d04

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1659&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1659&range=00-01

  Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1659.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1659/head:pull/1659

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


More information about the net-dev mailing list