Skip to content
Closed
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
25 changes: 19 additions & 6 deletions test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@
import java.io.*;
import java.lang.reflect.*;
import java.rmi.registry.*;
import java.util.concurrent.CountDownLatch;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why you would want to do this, as mainline change introduced this out-of-order. But for backports, you want to stay faithful to the original commit as much as possible. So refrain from making cosmetic changes as you go. If you still want to fix this, you can do a trivial PR against mainline, and backport the follow-up fix. But I think it does not worth the trouble.

import sun.rmi.transport.*;

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
Expand All @@ -74,6 +77,9 @@ public void ping () throws RemoteException { }
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;
Expand Down Expand Up @@ -113,8 +119,14 @@ public static void main (String[] args) {
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);
Expand All @@ -125,8 +137,8 @@ public static void main (String[] args) {
}
}

/* 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) {
Comment on lines +140 to +141
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your comment: "The "(numLeft > 2)" condition which was changed to "(numLeft > 4)" then changed back to "(numLeft > 2)". AFAICS, the original commit has this hunk exactly as you have written here?

openjdk/jdk@4b4d0cd#diff-9348ad66aa09ad1a3d437e736b0ec93f9f674ba91864fd15ca59375093386548L128-R141

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit changed the condition in line 132/129 of "CheckLeaseLeak.java" from "(numLeft > 2)" to "(numLeft > 4)"

openjdk/jdk@5a44219

Then the following commit changed the condition in line 129/141 from "(numLeft > 4)" back to "(numLeft > 2)"

openjdk/jdk@4b4d0cd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but why does it matter for this backport? openjdk/jdk@5a44219 is already in 25u. So openjdk/jdk@4b4d0cd that you are backporting is clean addition on top of it?

I am just confused why the merge was even required.

TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
numLeft);
} else {
Expand Down Expand Up @@ -204,8 +216,9 @@ private static int getDGCLeaseTableSize () {
* 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);
Expand Down