Skip to content

Commit fae7961

Browse files
committed
8257884: Re-enable sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java as automatic test
Reviewed-by: xuelei
1 parent 79f1dfb commit fae7961

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,26 @@
2626
import javax.net.SocketFactory;
2727
import javax.net.ssl.SSLSocketFactory;
2828

29+
import jdk.test.lib.Platform;
2930
import jdk.test.lib.util.FileUtils;
3031

3132
/*
3233
* @test
33-
* @bug 8256818 8257670
34+
* @bug 8256818 8257670 8257884
3435
* @summary Test that creating and closing SSL Sockets without bind/connect
3536
* will not leave leaking socket file descriptors
3637
* @library /test/lib
37-
* @run main/manual SSLSocketLeak
38+
* @run main/othervm SSLSocketLeak
3839
*/
3940
// Note: this test is not reliable, run it manually.
4041
public class SSLSocketLeak {
4142

43+
// number of sockets to open/close
4244
private static final int NUM_TEST_SOCK = 500;
4345

46+
// percentage of accepted growth of open handles
47+
private static final int OPEN_HANDLE_GROWTH_THRESHOLD = Platform.isWindows() ? 25 : 10;
48+
4449
public static void main(String[] args) throws IOException {
4550
long fds_start = FileUtils.getProcessHandleCount();
4651
System.out.println("FDs at the beginning: " + fds_start);
@@ -53,7 +58,7 @@ public static void main(String[] args) throws IOException {
5358
long fds_end = FileUtils.getProcessHandleCount();
5459
System.out.println("FDs in the end: " + fds_end);
5560

56-
if ((fds_end - fds_start) > (NUM_TEST_SOCK / 10)) {
61+
if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) {
5762
throw new RuntimeException("Too many open file descriptors. Looks leaky.");
5863
}
5964
}

0 commit comments

Comments
 (0)