8166763: java/rmi/* tests fail intermittently with "Port already in use" in RMID.start()

Reviewed-by: chegar
This commit is contained in:
Hamlin Li 2016-12-12 17:29:46 -08:00
parent 0870c6c734
commit 634875f391
11 changed files with 51 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,8 @@
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* java.base/sun.nio.ch
* @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider
* DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub
* @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup
*/
@ -123,7 +124,7 @@ public class DownloadActivationGroup
* Start rmid.
*/
RMID.removeLog();
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none";
rmid.addOptions(new String[] { execPolicyOption });
rmid.start();

View File

@ -0,0 +1,7 @@
grant {
permission java.lang.RuntimePermission "selectorProvider";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,8 @@
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* java.base/sun.nio.ch
* @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider
* @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup
*/
@ -63,7 +64,7 @@ public class IdempotentActiveGroup {
try {
RMID.removeLog();
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
rmid.start();
System.err.println("Create group descriptor");

View File

@ -0,0 +1,7 @@
grant {
permission java.lang.RuntimePermission "selectorProvider";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
};

View File

@ -110,7 +110,7 @@ public class ModifyDescriptor
try {
RMID.removeLog();
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
rmid.start();
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,8 @@
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* java.base/sun.nio.ch
* @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider
* CanCreateStubs StubClassesPermitted_Stub
* @run main/othervm/java.security.policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted
*/
@ -98,7 +99,7 @@ public class StubClassesPermitted
// start an rmid.
RMID.removeLog();
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
rmid.start();
//rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"});

View File

@ -4,4 +4,9 @@ grant {
// test needs to export a set of internal APIs to access them from unamed module
permission com.sun.rmi.rmid.ExecOptionPermission "*";
permission java.lang.RuntimePermission "selectorProvider";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,8 @@
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe
* java.base/sun.nio.ch
* @build TestLibrary RMID ActivationLibrary ActivateMe RMIDSelectorProvider
* @run main/othervm/policy=security.policy UnregisterGroup
*/
@ -76,7 +77,7 @@ public class UnregisterGroup extends Activatable implements ActivateMe
try {
RMID.removeLog();
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
rmid.start();
/* Cause activation groups to have a security policy that will

View File

@ -1,4 +1,9 @@
grant {
permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default";
permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*";
permission java.lang.RuntimePermission "selectorProvider";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
};

View File

@ -32,7 +32,8 @@
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Echo EchoImpl EchoImpl_Stub
* java.base/sun.nio.ch
* @build TestLibrary Echo EchoImpl EchoImpl_Stub RMIDSelectorProvider
* @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory
*/
@ -61,7 +62,7 @@ public class UseCustomSocketFactory {
RMID rmid = null;
try {
rmid = RMID.createRMID();
rmid = RMID.createRMIDOnEphemeralPort();
rmid.addArguments(new String[] {
"-C-Djava.security.policy=" +
TestParams.defaultGroupPolicy +

View File

@ -0,0 +1,7 @@
grant {
permission java.lang.RuntimePermission "selectorProvider";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
};