# HG changeset patch # User clanger # Date 1609268399 0 # Node ID ad14880e46c4d9f2efb551265cbc28fc95892425 # Parent 9078bcb5499aca75e827b91881fb2ff526795649 8257884: Re-enable sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java as automatic test Reviewed-by: xuelei diff -r 9078bcb5499a -r ad14880e46c4 test/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java --- a/test/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java Tue Dec 29 18:49:16 2020 +0000 +++ b/test/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java Tue Dec 29 18:59:59 2020 +0000 @@ -31,7 +31,7 @@ /* * @test - * @bug 8256818 8257670 + * @bug 8256818 8257670 8257884 * @summary Test that creating and closing SSL Sockets without bind/connect * will not leave leaking socket file descriptors * @run main/native/manual/othervm SSLSocketLeak @@ -48,10 +48,14 @@ // Note: this test is not reliable, run it manually. public class SSLSocketLeak { + // number of sockets to open/close private static final int NUM_TEST_SOCK = 500; private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().startsWith("windows"); private static volatile boolean nativeLibLoaded; + // percentage of accepted growth of open handles + private static final int OPEN_HANDLE_GROWTH_THRESHOLD = IS_WINDOWS ? 25 : 10; + public static void main(String[] args) throws IOException { long fds_start = getProcessHandleCount(); System.out.println("FDs at the beginning: " + fds_start); @@ -64,7 +68,7 @@ long fds_end = getProcessHandleCount(); System.out.println("FDs in the end: " + fds_end); - if ((fds_end - fds_start) > (NUM_TEST_SOCK / 10)) { + if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) { throw new RuntimeException("Too many open file descriptors. Looks leaky."); } }