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

Daniel Fuchs dfuchs at openjdk.java.net
Mon Dec 7 14:56:17 UTC 2020


On Mon, 7 Dec 2020 11:39:30 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.
>
> 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

test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java line 27:

> 25:  * @test
> 26:  * @bug 8255124 8255583
> 27:  * @summary Tests that KeepAliveStreamCleaner run does not throw an IllegalMonitorState Exception.

Thanks for the summary!
`@bug` should only list `8255124` ; We typically don't list issues that affect the tests only. We only list those that affect the JDK source code and which can be verified by running the test.

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

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


More information about the net-dev mailing list