Skip to content

8088343: Intermittent unit test failure in javafx.concurrent.ServiceLifecycleTest #1769

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 5 commits into
base: master
Choose a base branch
from

Conversation

andy-goryachev-oracle
Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle commented Apr 10, 2025

The code should not set the Task.state value to CANCELLED if the said task is already SUCCEEDED or FAILED.

This is a product bug.

Added @RepeatedTest(50) to the tests that used to fail intermittently - this made the test failed more reliably without the fix.


Progress

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

Issue

  • JDK-8088343: Intermittent unit test failure in javafx.concurrent.ServiceLifecycleTest (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1769

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1769.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 10, 2025

👋 Welcome back angorya! 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 Apr 10, 2025

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

@andy-goryachev-oracle andy-goryachev-oracle marked this pull request as ready for review April 10, 2025 21:31
@openjdk openjdk bot added the rfr Ready for review label Apr 10, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 10, 2025

Webrevs

@kevinrushforth
Copy link
Member

Reviewers: @kevinrushforth @arapte

/reviewers 2

@openjdk
Copy link

openjdk bot commented Apr 10, 2025

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@kevinrushforth kevinrushforth self-requested a review April 11, 2025 16:08
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

Avoiding the case where we transition from FAILED or SUCCEEDED to CANCELLED is good, and should fix the test failures (although I'll do some additional testing), but I can't help wondering if underlying problem is something else. The question I have is: how do we get into a state where Worker.State of the Task one of the completion states (FAILED or SUCCEEDED), whereas the parent FutureTask is not completed, and so enters a canceled state. You can see this by instrumenting the code and calling super.isCancelled().

I wonder if the custom service created by TestServiceFactory is causing, or contributing to, the problem?

Comment on lines +1019 to +1021
switch (getState()) {
case FAILED:
case SUCCEEDED:
Copy link
Member

Choose a reason for hiding this comment

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

Avoiding transitioning from a one of the completion states to canceled is a good thing. My question, though is: how did we get here? Is this masking some other problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the variations in the test timing uncovered this issue. I don't think it's a problem with the execution of the task, but rather with the reporting of its final state.

break;
}
});
return rv.get();
Copy link
Member

Choose a reason for hiding this comment

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

This is ineffective since you don't wait for the runLater to execute (and waiting could lead to deadlock, so I wouldn't recommend that). I don't think there is anything better than unconditionally returning flag when not running on the FX app thread. That's what the current code does (and is what your proposed fix will do most of the time).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point!

In this particular case, returning true from cancel() when state will not be changed is acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants