[9] RFR: 8164159: java/nio/file/WatchService/UpdateInterference.java test leaves daemon threads

Artem Smotrakov artem.smotrakov at oracle.com
Thu Aug 18 17:19:20 UTC 2016


Re-sending nio-dev at openjdk.java.net

Artem


On 08/16/2016 04:11 PM, Artem Smotrakov wrote:
> Hello,
>
> Please review the following patch for 
> java/nio/file/WatchService/UpdateInterference.java test.
>
> The test creates a couple of daemon threads which have an infinite 
> loop inside. When the test finishes, those daemon still keep running 
> as long as jtreg use this instance of JVM to run other tests (the test 
> doesn't run in othervm mode).
>
> The test also creates a WatchService which creates a 
> "FileSystemWatchService" daemon thread. Then, the test doesn't close 
> this WatchService, and as a result, this daemon thread keeps running 
> as well.
>
> The test shouldn't leave daemon threads when it finishes. It may slow 
> down further test execution. If other tests also leave daemon threads, 
> it may cause intermittent test failures, see for example JDK-8160642 
> and JDK-8162757.
>
> The patch updates the test with the following:
> - threads are not daemons any more
> - "while" loops are not infinite
> - the test waits for threads to finish before closing a watch service 
> to avoid ClosedWatchServiceException
> - the test closes a watch service in try-with-resources block
> - the test removes temporary files and directories in the end
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8164159
> Webrev: http://cr.openjdk.java.net/~asmotrak/8164159/webrev.00/
>
> Artem



More information about the nio-dev mailing list