< prev index next >

test/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java

Print this page
rev 14408 : 8256818: SSLSocket that is never bound or connected leaks socket resources
Reviewed-by: xuelei
rev 14409 : 8257670: sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java reports leaks
Reviewed-by: jnimeh
rev 14410 : 8257884: Re-enable sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java as automatic test
Reviewed-by: xuelei
rev 14411 : 8257997: sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java again reports leaks after JDK-8257884
Reviewed-by: mbaesken

*** 29,39 **** import com.sun.management.UnixOperatingSystemMXBean; /* * @test ! * @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 * @comment native library is required only on Windows, use the following commands: * "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" --- 29,39 ---- import com.sun.management.UnixOperatingSystemMXBean; /* * @test ! * @bug 8256818 8257670 8257884 8257997 * @summary Test that creating and closing SSL Sockets without bind/connect * will not leave leaking socket file descriptors * @run main/native/manual/othervm SSLSocketLeak * @comment native library is required only on Windows, use the following commands: * "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
*** 43,62 **** * /I<path/to/jdkbin>\include ^ * /I<path/to/jdkbin>\include\win32 ^ * /FeFileUtils.dll * jtreg <...> -nativepath:. <path/to/jdk8u>\jdk\test\sun\security\ssl\SSLSocketImpl\SSLSocketLeak.java */ - // 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); --- 43,61 ---- * /I<path/to/jdkbin>\include ^ * /I<path/to/jdkbin>\include\win32 ^ * /FeFileUtils.dll * jtreg <...> -nativepath:. <path/to/jdk8u>\jdk\test\sun\security\ssl\SSLSocketImpl\SSLSocketLeak.java */ 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_PERCENTAGE = 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);
*** 66,76 **** } long fds_end = getProcessHandleCount(); System.out.println("FDs in the end: " + fds_end); ! if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) { throw new RuntimeException("Too many open file descriptors. Looks leaky."); } } // Return the current process handle count --- 65,75 ---- } long fds_end = getProcessHandleCount(); System.out.println("FDs in the end: " + fds_end); ! if ((fds_end - fds_start) > ((NUM_TEST_SOCK * OPEN_HANDLE_GROWTH_THRESHOLD_PERCENTAGE)) / 100) { throw new RuntimeException("Too many open file descriptors. Looks leaky."); } } // Return the current process handle count
< prev index next >