RFR: 8255583: Investigate creating a test to trigger the condition in KeepAliveStreamCleaner
Daniel Fuchs
dfuchs at openjdk.java.net
Mon Dec 7 10:58:12 UTC 2020
On Mon, 7 Dec 2020 09:52:47 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
> 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.
test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java line 26:
> 24: /*
> 25: * @test
> 26: * @modules java.base/sun.net.www.http
Hi Conor,
Can you add:
@bug 8255124
here? [8255124](https://bugs.openjdk.java.net/browse/JDK-8255124) is the issue whose fix this test is verifying.
best regards,
-- daniel
-------------
PR: https://git.openjdk.java.net/jdk/pull/1659
More information about the security-dev
mailing list