< prev index next >

test/jdk/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java

Print this page

  1 /*
  2  * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 /*
 25  * author Edward Wang
 26  *
 27  * @test
 28  * @bug 6368984
 29  * @key intermittent
 30  * @summary Configuring unconnected Socket before passing to implAccept
 31  *          can cause fd leak.
 32  *          This test may fail intermittently if foreign processes will
 33  *          try to establish connection to the test server socket.
 34  * @requires (os.family != "windows")

 35  * @library /test/lib
 36  * @build jdk.test.lib.Utils
 37  *        jdk.test.lib.Asserts
 38  *        jdk.test.lib.JDKToolFinder
 39  *        jdk.test.lib.JDKToolLauncher
 40  *        jdk.test.lib.Platform
 41  *        jdk.test.lib.process.*
 42  *        AcceptCauseFileDescriptorLeak
 43  * @run main/othervm AcceptCauseFileDescriptorLeak root
 44  */
 45 
 46 import java.io.IOException;
 47 import java.net.InetAddress;
 48 import java.net.InetSocketAddress;
 49 import java.net.ServerSocket;
 50 import java.net.Socket;
 51 import java.util.List;
 52 
 53 import jdk.test.lib.JDKToolFinder;
 54 import jdk.test.lib.process.OutputAnalyzer;

  1 /*
  2  * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 /*
 25  * author Edward Wang
 26  *
 27  * @test
 28  * @bug 6368984
 29  * @key intermittent
 30  * @summary Configuring unconnected Socket before passing to implAccept
 31  *          can cause fd leak.
 32  *          This test may fail intermittently if foreign processes will
 33  *          try to establish connection to the test server socket.
 34  * @requires os.family != "windows"
 35  * @requires vm.flagless
 36  * @library /test/lib
 37  * @build jdk.test.lib.Utils
 38  *        jdk.test.lib.Asserts
 39  *        jdk.test.lib.JDKToolFinder
 40  *        jdk.test.lib.JDKToolLauncher
 41  *        jdk.test.lib.Platform
 42  *        jdk.test.lib.process.*
 43  *        AcceptCauseFileDescriptorLeak
 44  * @run main/othervm AcceptCauseFileDescriptorLeak root
 45  */
 46 
 47 import java.io.IOException;
 48 import java.net.InetAddress;
 49 import java.net.InetSocketAddress;
 50 import java.net.ServerSocket;
 51 import java.net.Socket;
 52 import java.util.List;
 53 
 54 import jdk.test.lib.JDKToolFinder;
 55 import jdk.test.lib.process.OutputAnalyzer;
< prev index next >