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 * @summary Configuring unconnected Socket before passing to implAccept
30 * can cause fd leak
31 * @requires (os.family != "windows")
32 * @library /test/lib
33 * @build jdk.test.lib.JDKToolFinder
34 * jdk.test.lib.process.OutputAnalyzer
35 * AcceptCauseFileDescriptorLeak
36 * @run main/othervm AcceptCauseFileDescriptorLeak root
37 */
38
39 import java.io.IOException;
40 import java.net.ServerSocket;
41 import java.net.Socket;
42 import java.util.List;
43
44 import jdk.test.lib.JDKToolFinder;
45 import jdk.test.lib.process.OutputAnalyzer;
46
47 public class AcceptCauseFileDescriptorLeak {
48 private static final int REPS = 2048;
49 private static final int THRESHOLD = 1024;
50
51 public static void main(String[] args) throws Exception {
52 if (args.length != 0) {
53 OutputAnalyzer analyzer = execCmd("ulimit -n -H");
54 String output = analyzer.getOutput();
55 if (output == null || output.length() == 0) {
|
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 * @summary Configuring unconnected Socket before passing to implAccept
30 * can cause fd leak
31 * @requires (os.family != "windows")
32 * @library /test/lib
33 * @run main/othervm AcceptCauseFileDescriptorLeak root
34 */
35
36 import java.io.IOException;
37 import java.net.ServerSocket;
38 import java.net.Socket;
39 import java.util.List;
40
41 import jdk.test.lib.JDKToolFinder;
42 import jdk.test.lib.process.OutputAnalyzer;
43
44 public class AcceptCauseFileDescriptorLeak {
45 private static final int REPS = 2048;
46 private static final int THRESHOLD = 1024;
47
48 public static void main(String[] args) throws Exception {
49 if (args.length != 0) {
50 OutputAnalyzer analyzer = execCmd("ulimit -n -H");
51 String output = analyzer.getOutput();
52 if (output == null || output.length() == 0) {
|