Skip to content

Conversation

@jaikiran
Copy link
Member

@jaikiran jaikiran commented Dec 19, 2025

Can I please get a review of this test-only change which addresses intermittent failures in java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java?

The @summary in that test's test definition about what this test does:

@summary When the "java.rmi.dgc.leaseValue" system property is set to a
value much lower than its default (10 minutes), then the server-side
user-visible detection of DGC lease expiration-- in the form of
Unreferenced.unreferenced() invocations and possibly even local garbage
collection (including weak reference notification, finalization, etc.)--
may be delayed longer than expected. While this is not a spec violation
(because there are no timeliness guarantees for any of these garbage
collection-related events), the user might expect that an unreferenced()
invocation for an object whose last client has terminated abnormally
should occur on relatively the same time order as the lease value
granted.

In its current form, the test uses a lease expiry of 10 seconds, launches a trivial java application which looks up the bound object from the registry and then terminates itself. After launching that trivial java application, the test then waits for 20 seconds, expecting that the Unreferenced.unreferenced() callback (upon lease expiry of 10 seconds) will be called within those 20 seconds. This wait intermittently fails because the Unreferenced.unreferenced() doesn't get called within those 20 seconds.

Experiments show that the reason for these intermittent failures is due to the SelfTerminator application which does the registry lookup (and which involves connection establishment and communication over a socket) can sometimes take several seconds (5 or more for example). That effectively means that by the time this SelfTerminator starts its termination after the lookup, it's already several seconds into the "wait()" in the test.

The commit in this PR cleans up the test to more accurately track the duration of how long it took between the lease expiry and the Unreferenced.unreferenced() callback to be invoked. Additionally, just to make the test more robust, the maximum expected duration has been increased to 60 seconds instead of 20 seconds. Given the text in the test's summary, I think this increase is still within the expectations of how long it takes for the callback to be invoked after the client has exited abnormally.

The test continues to pass with this change and a test repeat of 50 too did not reproduce any failures.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8170896: TEST_BUG: java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java failed with unreferenced() not invoked after 20.0 seconds (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28919/head:pull/28919
$ git checkout pull/28919

Update a local copy of the PR:
$ git checkout pull/28919
$ git pull https://git.openjdk.org/jdk.git pull/28919/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28919

View PR using the GUI difftool:
$ git pr show -t 28919

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28919.diff

Using Webrev

Link to Webrev Comment

…aseCheckInterval.java failed with unreferenced() not invoked after 20.0 seconds
@bridgekeeper
Copy link

bridgekeeper bot commented Dec 19, 2025

👋 Welcome back jpai! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 19, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Dec 19, 2025

@jaikiran The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 19, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 19, 2025

Webrevs

@msheppar
Copy link

msheppar commented Dec 19, 2025

replacing the obj.lock.wait(TIMEOUT); with the do while loop is a good change as the Object.wait is susceptible to intermittent early return. jtreg takes care of a test timeout.

BUT I think it possible to simply the main test logic a bit. The Object wait/notify could be replaced by a CountDownLatch.

The remote unreferenced method counts down the latch and the main test thread awaits the count down of the latch (in place of the do while). Thus removing the synchronize logic. This eliminates the necessity for the assert assert and for a state variable unreferenced.

lines 121 - 136 are a refactor extract method isWithinTimeLimits

one could debate if the temporal checks are necessary, as they cannot be guaranteed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants