8365398: TEST_BUG: java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java failing intermittently

Reviewed-by: msheppar, smarks, jpai
This commit is contained in:
Johny Jose 2025-10-07 13:13:42 +00:00 committed by Mark Sheppard
parent 9c46febcac
commit 4b4d0cd35a
2 changed files with 19 additions and 7 deletions

View File

@ -608,7 +608,6 @@ java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-al
java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all
java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all
java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 8365398 generic-all
java/rmi/Naming/DefaultRegistryPort.java 8005619 windows-all
java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java 8005619 windows-all

View File

@ -59,10 +59,13 @@ import java.io.*;
import java.lang.reflect.*;
import java.rmi.registry.*;
import sun.rmi.transport.*;
import java.util.concurrent.CountDownLatch;
public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
public CheckLeaseLeak() throws RemoteException { }
public void ping () throws RemoteException { }
public void ping () throws RemoteException {
remoteCallsComplete.countDown();
}
/**
* Id to fake the DGC_ID, so we can later get a reference to the
@ -74,6 +77,9 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
private final static int numberPingCalls = 0;
private final static int CHECK_INTERVAL = 400;
private final static int LEASE_VALUE = 20;
private static final int NO_OF_CLIENTS = ITERATIONS;
private static final int GOOD_LUCK_FACTOR = 2;
private static CountDownLatch remoteCallsComplete = new CountDownLatch(NO_OF_CLIENTS);
public static void main (String[] args) {
CheckLeaseLeak leakServer = null;
@ -113,8 +119,14 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
jvm.destroy();
}
}
try {
remoteCallsComplete.await();
System.out.println("remoteCallsComplete . . . ");
} catch (InterruptedException intEx) {
System.out.println("remoteCallsComplete.await interrupted . . . ");
}
Thread.sleep(NO_OF_CLIENTS * LEASE_VALUE * GOOD_LUCK_FACTOR);
numLeft = getDGCLeaseTableSize();
Thread.sleep(3000);
} catch(Exception e) {
TestLibrary.bomb("CheckLeaseLeak Error: ", e);
@ -125,8 +137,8 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
}
}
/* numLeft should be 4 - if 11 there is a problem. */
if (numLeft > 4) {
/* numLeft should not be greater than 2 - if 11 there is a problem. */
if (numLeft > 2) {
TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
numLeft);
} else {
@ -204,8 +216,9 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
* objects if the LeaseInfo memory leak is not fixed.
*/
leaseTable = (Map) f.get(dgcImpl[0]);
numLeaseInfosLeft = leaseTable.size();
synchronized (leaseTable) {
numLeaseInfosLeft = leaseTable.size();
}
} catch(Exception e) {
TestLibrary.bomb(e);