Skip to content
Permalink
Browse files
8257997: sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java again repo…
…rts leaks after JDK-8257884

Reviewed-by: mbaesken
  • Loading branch information
RealCLanger committed Dec 10, 2020
1 parent db5da96 commit 29ffffa7b938a57ab306c4e32a38d5c6cd7dfbc9
Showing 1 changed file with 3 additions and 4 deletions.
@@ -31,20 +31,19 @@

/*
* @test
* @bug 8256818 8257670 8257884
* @bug 8256818 8257670 8257884 8257997
* @summary Test that creating and closing SSL Sockets without bind/connect
* will not leave leaking socket file descriptors
* @library /test/lib
* @run main/othervm SSLSocketLeak
*/
// 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;

// percentage of accepted growth of open handles
private static final int OPEN_HANDLE_GROWTH_THRESHOLD = Platform.isWindows() ? 25 : 10;
private static final int OPEN_HANDLE_GROWTH_THRESHOLD_PERCENTAGE = Platform.isWindows() ? 25 : 10;

public static void main(String[] args) throws IOException {
long fds_start = FileUtils.getProcessHandleCount();
@@ -58,7 +57,7 @@ public static void main(String[] args) throws IOException {
long fds_end = FileUtils.getProcessHandleCount();
System.out.println("FDs in the end: " + fds_end);

if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) {
if ((fds_end - fds_start) > ((NUM_TEST_SOCK * OPEN_HANDLE_GROWTH_THRESHOLD_PERCENTAGE)) / 100) {
throw new RuntimeException("Too many open file descriptors. Looks leaky.");
}
}

1 comment on commit 29ffffa

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 29ffffa Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.