Skip to content

7191877: TEST_BUG: java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java failing intermittently #2093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,6 @@ java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java 7140992 generi

java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-all

java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic-all

java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all
java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all

Expand Down
102 changes: 45 additions & 57 deletions test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
Expand Down Expand Up @@ -54,12 +54,11 @@

import java.rmi.*;
import java.rmi.server.*;
import sun.rmi.transport.*;
import sun.rmi.*;
import java.util.Map;
import java.io.*;
import java.lang.reflect.*;
import java.rmi.registry.*;
import sun.rmi.transport.*;

public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
public CheckLeaseLeak() throws RemoteException { }
Expand Down Expand Up @@ -102,8 +101,6 @@ public static void main (String[] args) {
System.err.println("Created client: " + i);

JavaVM jvm = new JavaVM("LeaseLeakClient",
" -Djava.security.policy=" +
TestParams.defaultPolicy +
" -Drmi.registry.port=" +
registryPort,
"");
Expand All @@ -128,8 +125,8 @@ public static void main (String[] args) {
}
}

/* numLeft should be 2 - if 11 there is a problem. */
if (numLeft > 2) {
/* numLeft should be 4 - if 11 there is a problem. */
if (numLeft > 4) {
TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
numLeft);
} else {
Expand All @@ -156,57 +153,51 @@ private static int getDGCLeaseTableSize () {
Field f;

try {
f = (Field) java.security.AccessController.doPrivileged
(new java.security.PrivilegedExceptionAction() {
public Object run() throws Exception {

ObjID dgcID = new ObjID(DGC_ID);

/*
* Construct an ObjectEndpoint containing DGC's
* ObjID.
*/
Class oeClass =
Class.forName("sun.rmi.transport.ObjectEndpoint");
Class[] constrParams =
new Class[]{ ObjID.class, Transport.class };
Constructor oeConstructor =
oeClass.getDeclaredConstructor(constrParams);
oeConstructor.setAccessible(true);
Object oe =
oeConstructor.newInstance(
new Object[]{ dgcID, null });

/*
* Get Target that contains DGCImpl in ObjectTable
*/
Class objTableClass =
Class.forName("sun.rmi.transport.ObjectTable");
Class getTargetParams[] = new Class[] { oeClass };
Method objTableGetTarget =
objTableClass.getDeclaredMethod("getTarget",
getTargetParams);
objTableGetTarget.setAccessible(true);
Target dgcTarget = (Target)
objTableGetTarget.invoke(null, new Object[]{ oe });

/* get the DGCImpl from its Target */
Method targetGetImpl =
dgcTarget.getClass().getDeclaredMethod
ObjID dgcID = new ObjID(DGC_ID);
/*
* Construct an ObjectEndpoint containing DGC's
* ObjID.
*/
Class oeClass =
Class.forName("sun.rmi.transport.ObjectEndpoint");
Class[] constrParams =
new Class[]{ ObjID.class, Transport.class };
Constructor oeConstructor =
oeClass.getDeclaredConstructor(constrParams);
oeConstructor.setAccessible(true);
Object oe =
oeConstructor.newInstance(
new Object[]{ dgcID, null });

/*
* Get Target that contains DGCImpl in ObjectTable
*/
Class objTableClass =
Class.forName("sun.rmi.transport.ObjectTable");
Class getTargetParams[] = new Class[] { oeClass };
Method objTableGetTarget =
objTableClass.getDeclaredMethod("getTarget",
getTargetParams);
objTableGetTarget.setAccessible(true);
Target dgcTarget = (Target)
objTableGetTarget.invoke(null, new Object[]{ oe });

/* get the DGCImpl from its Target */
Method targetGetImpl =
dgcTarget.getClass().getDeclaredMethod
("getImpl", null);
targetGetImpl.setAccessible(true);
dgcImpl[0] =
(Remote) targetGetImpl.invoke(dgcTarget, null);
targetGetImpl.setAccessible(true);
dgcImpl[0] =
(Remote) targetGetImpl.invoke(dgcTarget, null);

/* Get the lease table from the DGCImpl. */
Field reflectedLeaseTable =
dgcImpl[0].getClass().getDeclaredField
/* Get the lease table from the DGCImpl. */
Field reflectedLeaseTable =
dgcImpl[0].getClass().getDeclaredField
("leaseTable");
reflectedLeaseTable.setAccessible(true);
reflectedLeaseTable.setAccessible(true);

f = reflectedLeaseTable;

return reflectedLeaseTable;
}
});

/**
* This is the leaseTable that will fill up with LeaseInfo
Expand All @@ -217,9 +208,6 @@ public Object run() throws Exception {
numLeaseInfosLeft = leaseTable.size();

} catch(Exception e) {
if (e instanceof java.security.PrivilegedActionException)
e = ((java.security.PrivilegedActionException) e).
getException();
TestLibrary.bomb(e);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
Expand Down Expand Up @@ -27,7 +27,6 @@

public class LeaseLeakClient {
public static void main(String args[]) {
TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");

try {
LeaseLeak leaseLeak = null;
Expand Down