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

8198402: ToggleButton.setToggleGroup causes memory leak when button is removed via ToggleGroup.getToggles() #167

Closed
wants to merge 4 commits into from

Conversation

jskov
Copy link
Contributor

@jskov jskov commented Apr 9, 2020

Make the two ways of associating a ToggleButton with a ToggleGroup interact correctly.

This fixes https://bugs.openjdk.java.net/browse/JDK-8198402


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8198402: ToggleButton.setToggleGroup causes memory leak when button is removed via ToggleGroup.getToggles()

Reviewers

  • Kevin Rushforth (kcr - Reviewer)
  • Ambarish Rapte (arapte - Reviewer)

Download

$ git fetch https://git.openjdk.java.net/jfx pull/167/head:pull/167
$ git checkout pull/167

Make the two ways of associating a ToggleButton with a ToggleGroup
interact correctly.
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 9, 2020

Hi @jskov, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user jskov" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Apr 9, 2020
@jskov
Copy link
Contributor Author

jskov commented Apr 9, 2020

/signed

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 9, 2020

Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

@bridgekeeper bridgekeeper bot added the oca-verify Needs verification of OCA signatory status label Apr 9, 2020
@bridgekeeper bridgekeeper bot removed oca Needs verification of OCA signatory status oca-verify Needs verification of OCA signatory status labels Apr 16, 2020
@openjdk openjdk bot added the rfr Ready for review label Apr 16, 2020
@mlbridge
Copy link

mlbridge bot commented Apr 16, 2020

Webrevs

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Apr 18, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@kevinrushforth
Copy link
Member

@arapte can you also review?

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.

The fix looks correct to me. Have you run all tests to ensure no regressions?

I left a couple inline comments.

@@ -193,14 +193,17 @@ public String getName() {
* being added to the new group.
*/
private ObjectProperty<ToggleGroup> toggleGroup;
@Override
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 unrelated to the fix. The changes in this file should be reverted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. They are gone.

Would this (keeping the changes very specific to the bug?) be worth mentioning in CONTRIBUTING.md?
That is, like the note about imports: do not fix warnings that are not directly related to the issue?

Copy link
Member

Choose a reason for hiding this comment

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

Good idea. I'll add that to my growing list of things to improve in CONTRIBUTING.md.

@jskov
Copy link
Contributor Author

jskov commented Apr 19, 2020

@kevinrushforth I tested by:
bash ./gradlew clean all test -x :web:test
I assumed that would do it.
But I see use of ToggleButton in javafx.web, so that was clearly a faulty assumption.

I will try to get webkit working.

@jskov
Copy link
Contributor Author

jskov commented Apr 19, 2020

I have failed getting web:tests to work.
Both with java 11.0.7 and 14.0.0 (adoptajdk 14.0.1 not ready yet), I get the error below.

And that is with both a locally built webkit, and the one from javafx-web-15-ea+3-linux.jar

So it seems I am unable to run web:tests task on my box (Fedora 31, FWIW).

Any suggestions for how to resolve this?

> Task :web:test
*****************************************************
WARNING: running web tests without building webkit.
The webkit native library will be copied from the JDK,
which might lead to failures in some web tests.
To avoid these failures, you should either build
webkit locally, copy the native webkit library from a
recent build, or skip execution of web test cases with
'-x :web:test'
*****************************************************
Exception in thread "JavaFX Application Thread" 
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f4e01ae8a61, pid=78774, tid=78815
#
# JRE version: OpenJDK Runtime Environment (11.0.7+10) (build 11.0.7+10)
# Java VM: OpenJDK 64-Bit Server VM (11.0.7+10, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x579a61]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<1097844ul, G1BarrierSet>, (AccessInternal::BarrierType)2, 1097844ul>::oop_access_barrier(void*)+0x1
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /opt/sources/github/jfx/modules/javafx.web/core.78774)
#
# An error report file with more information is saved as:
# /opt/sources/github/jfx/modules/javafx.web/hs_err_pid78774.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/AdoptOpenJDK/openjdk-support/issues
#

@jskov
Copy link
Contributor Author

jskov commented Apr 19, 2020

Uh, the exception is (as the comment note suggests) from using a prebuilt webkit.
I will try a locally built one now.

@jskov
Copy link
Contributor Author

jskov commented Apr 19, 2020

Ah, well. Ended with the same VM crash when building webkit myself.

So I am kinda stuck. Suggestions?

@jskov
Copy link
Contributor Author

jskov commented Apr 23, 2020

I have found out that my :web:test failed because I did not have the
media libs properly installed.

So the changes in this PR pass all tests.

@kevinrushforth
Copy link
Member

Good to know. I'll finish my review today.

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

Fix and tests look good to me.

@openjdk
Copy link

openjdk bot commented Apr 28, 2020

@jskov This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

8198402: ToggleButton.setToggleGroup causes memory leak when button is removed via ToggleGroup.getToggles()

Reviewed-by: kcr, arapte
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 31 commits pushed to the master branch:

  • 8ad5805: 8191758: Match WebKit's font weight rendering with JavaFX
  • 66c3b38: 8227425: Add support for e-paper displays on i.MX6 devices
  • e30049f: 8242077: Add information about HTTP/2 and HttpClient usage in WebEngine
  • e0ffca3: 8242505: Some WebKit tests might fail because Microsoft libraries are not loaded
  • ceb3fce: 8087555: [ChoiceBox] uncontained value not shown
  • 818ac00: 8175358: Memory leak when moving MenuButton into another Scene
  • 91d4c8b: 8241737: TabPaneSkin memory leak on replacing selectionModel
  • 48476eb: 8241582: Infinite animation does not start from the end when started with a negative rate
  • dedf7cb: 8242490: Upgrade to gcc 9.2 on Linux
  • 5e9fb82: 8242577: Cell selection fails on iOS most of the times
  • ... and 21 more: https://git.openjdk.java.net/jfx/compare/c154538fab8d9043ae374318ed0eda8c80150b37...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate 8ad5805272eef7021703cd2b8f8fef4573eca5f0.

As you are not a known OpenJDK Author, an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @arapte) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label Apr 28, 2020
@jskov
Copy link
Contributor Author

jskov commented Apr 30, 2020

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Apr 30, 2020
@openjdk
Copy link

openjdk bot commented Apr 30, 2020

@jskov
Your change (at version 10eef05) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

/sponsor

@openjdk openjdk bot closed this Apr 30, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Ready to sponsor ready Ready to be integrated labels Apr 30, 2020
@openjdk
Copy link

openjdk bot commented Apr 30, 2020

@kevinrushforth @jskov The following commits have been pushed to master since your change was applied:

  • 8ad5805: 8191758: Match WebKit's font weight rendering with JavaFX
  • 66c3b38: 8227425: Add support for e-paper displays on i.MX6 devices
  • e30049f: 8242077: Add information about HTTP/2 and HttpClient usage in WebEngine
  • e0ffca3: 8242505: Some WebKit tests might fail because Microsoft libraries are not loaded
  • ceb3fce: 8087555: [ChoiceBox] uncontained value not shown
  • 818ac00: 8175358: Memory leak when moving MenuButton into another Scene
  • 91d4c8b: 8241737: TabPaneSkin memory leak on replacing selectionModel
  • 48476eb: 8241582: Infinite animation does not start from the end when started with a negative rate
  • dedf7cb: 8242490: Upgrade to gcc 9.2 on Linux
  • 5e9fb82: 8242577: Cell selection fails on iOS most of the times
  • 69e4266: 8242489: ChoiceBox: initially toggle not sync'ed to selection
  • 1d88180: 8243112: Skip failing test SVGTest.testSVGRenderingWithPattern
  • ec8608f: 8223298: SVG patterns are drawn wrong
  • e82046e: 8242530: [macos] Some audio files miss spectrum data when another audio file plays first
  • 7044cef: 8241476: Linux build warnings issued on gcc 9
  • 9d50c4c: Merge
  • 4d69a0d: 8241629: [macos10.15] Long startup delay playing media over https on Catalina
  • b1fdc45: 8242209: Increase web native thread stack size for x86 mode
  • e1cb191: 8240694: [macos 10.15] JavaFX Media hangs on some video files on Catalina
  • ef37669: Merge
  • f2bca9f: Merge
  • 6900d29: Merge
  • e91bec4: Merge
  • 66a8f49: Merge
  • fde42da: Merge
  • e21fd1f: Merge
  • 443c845: Merge
  • 31e63de: Merge
  • 14c6938: 8236798: Enhance FX scripting support
  • bfb2d0e: Merge
  • 39f6127: Merge

Your commit was automatically rebased without conflicts.

Pushed as commit 3130fc8.

@openjdk openjdk bot removed the rfr Ready for review label Apr 30, 2020
@jskov jskov deleted the toggleGroupSync-JDK-8198402 branch April 30, 2020 17:07
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
Development

Successfully merging this pull request may close these issues.

3 participants