Skip to content
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

8159048: Animation and AnimationTimer methods must be called on JavaFX Application thread #1167

Closed

Conversation

jperedadnr
Copy link
Collaborator

@jperedadnr jperedadnr commented Jul 3, 2023

This PR adds a check to the Animation and AnimationTimer public methods to verify that these are called from the JavaFX Application thread. If the call is done from any other thread, an IllegalStateException will be thrown.

This will prevent users from getting unexpected errors (typically NPE, like the one posted in the JBS issue), and will fail fast with a clear exception and reason for it.

The javadoc of the Animation and AnimationTimer classes and public methods has been updated accordingly.

Tests for both classes have been included, failing (as in no exceptions were thrown when calling from a background thread) before this patch, and passing (as in ISE was thrown).


Progress

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

Issues

  • JDK-8159048: Animation and AnimationTimer methods must be called on JavaFX Application thread (Bug - P4)
  • JDK-8313378: Animation and AnimationTimer methods must be called on JavaFX Application thread (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1167

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 3, 2023

👋 Welcome back jpereda! 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.

@kevinrushforth
Copy link
Member

@jperedadnr In case you missed it, this PR is not rfr due to white space errors.

@kevinrushforth
Copy link
Member

At first glance, this looks like a good fix. Since this enforces a new threading restriction on existing animation methods, it will need a CSR.

/csr
/reviewers 2

@kevinrushforth kevinrushforth self-requested a review July 29, 2023 13:53
@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Jul 29, 2023
@openjdk
Copy link

openjdk bot commented Jul 29, 2023

@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@jperedadnr please create a CSR request for issue JDK-8159048 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@openjdk
Copy link

openjdk bot commented Jul 29, 2023

@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).

@openjdk openjdk bot added the rfr Ready for review label Jul 30, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 30, 2023

Webrevs

@jperedadnr
Copy link
Collaborator Author

Thanks, @kevinrushforth, I've missed that, indeed.

I've filed the CSR draft: https://bugs.openjdk.org/browse/JDK-8313378

@andy-goryachev-oracle
Copy link
Contributor

minor: spelling in the title (Receiver)

@jperedadnr jperedadnr changed the title 8159048: Null PulseReciever in AbstractMasterTimer 8159048: Null PulseReceiver in AbstractMasterTimer Jul 31, 2023
@jperedadnr
Copy link
Collaborator Author

I've edited the title of the original JBS issue https://bugs.openjdk.org/browse/JDK-8159048 to fix the typo.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

looks good, thank you!

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.

Looks good.

The CSR is ready to "Finalize". As soon as it is approved, you can integrate.

@kevinrushforth
Copy link
Member

@jperedadnr One more thing I noticed: the titles of the bug and the CSR should match (it's not enforced, but it a best practice). So you should either change the title of the CSR back to match the title of the bug -- "Null PulseReceiver in AbstractMasterTimer" -- or change the title of the bug, along with this PR title, to match the CSR. In looking at it, I think the CSR title is more descriptive, so I might suggest some variant of that. Here a slightly shortened suggestion:

Animation and AnimationTimer methods must be called on JavaFX Application thread

but what you have is fine as well.

@jperedadnr
Copy link
Collaborator Author

Makes sense, I've updated the title of both JBS issue and CSR.

@kevinrushforth
Copy link
Member

Makes sense, I've updated the title of both JBS issue and CSR.

@jperedadnr You also need to update this PR title. Also, please "Finalize" the CSR when ready, since that will trigger the final review of the CSR.

@jperedadnr jperedadnr changed the title 8159048: Null PulseReceiver in AbstractMasterTimer 8159048: Animation and AnimationTimer methods must be called on JavaFX Application thread Aug 14, 2023
@jperedadnr
Copy link
Collaborator Author

Sorry, missed that change. Done.
Also I've updated the status CSR to finalized.

@openjdk
Copy link

openjdk bot commented Aug 14, 2023

@jperedadnr This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8159048: Animation and AnimationTimer methods must be called on JavaFX Application thread

Reviewed-by: angorya, kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 29 new commits pushed to the master branch:

  • a5183e5: 8283401: ArrayIndexOutOfBoundsException when disconnecting screen(s)
  • bedb964: 8307316: Let JavaFX be built on unknown architectures
  • 8998b2d: 8314141: Missing default for switch in CreateBitmap
  • 5d74176: 8313181: Enabling modern media controls on webkit 616.1 does not load button images on HTML5 video Element
  • 9f180e2: 8313900: Possible NULL pointer access in NativeAudioSpectrum and NativeVideoBuffer
  • 771273f: 8313799: Remove lockItemOnEdit flag from (Tree)TableCell
  • 1752b62: 8313856: Replace VLA with malloc in pango
  • af8950e: 8313711: Cherry-pick WebKit 616.1 stabilization fixes
  • d649a5e: 8260342: FXMLLoader fails to load a sub layout using fx:include with the resources attribute
  • 5f5e54f: 8313177: Web Workers timeout with Webkit 616.1
  • ... and 19 more: https://git.openjdk.org/jfx/compare/8fd2943c52cb47ec247ce0e6657afdc9bdc725ae...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Ready to be integrated and removed csr Need approved CSR to integrate pull request labels Aug 14, 2023
@jperedadnr
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 14, 2023

Going to push as commit c3257fc.
Since your change was applied there have been 29 commits pushed to the master branch:

  • a5183e5: 8283401: ArrayIndexOutOfBoundsException when disconnecting screen(s)
  • bedb964: 8307316: Let JavaFX be built on unknown architectures
  • 8998b2d: 8314141: Missing default for switch in CreateBitmap
  • 5d74176: 8313181: Enabling modern media controls on webkit 616.1 does not load button images on HTML5 video Element
  • 9f180e2: 8313900: Possible NULL pointer access in NativeAudioSpectrum and NativeVideoBuffer
  • 771273f: 8313799: Remove lockItemOnEdit flag from (Tree)TableCell
  • 1752b62: 8313856: Replace VLA with malloc in pango
  • af8950e: 8313711: Cherry-pick WebKit 616.1 stabilization fixes
  • d649a5e: 8260342: FXMLLoader fails to load a sub layout using fx:include with the resources attribute
  • 5f5e54f: 8313177: Web Workers timeout with Webkit 616.1
  • ... and 19 more: https://git.openjdk.org/jfx/compare/8fd2943c52cb47ec247ce0e6657afdc9bdc725ae...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 14, 2023
@openjdk openjdk bot closed this Aug 14, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Aug 14, 2023
@openjdk
Copy link

openjdk bot commented Aug 14, 2023

@jperedadnr Pushed as commit c3257fc.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants