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

8273969: Memory Leak on the Runnable provided to Platform.startup #626

Closed

Conversation

@FlorianKirmaier
Copy link
Member

@FlorianKirmaier FlorianKirmaier commented Sep 19, 2021

Probably my most boring PR. ;)
Setting the lambda to null, after it has been used, fixes the leak.


Progress

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

Issue

  • JDK-8273969: Memory Leak on the Runnable provided to Platform.startup

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/626/head:pull/626
$ git checkout pull/626

Update a local copy of the PR:
$ git checkout pull/626
$ git pull https://git.openjdk.java.net/jfx pull/626/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 626

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/626.diff

fix for leak and unit-test
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 19, 2021

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

@FlorianKirmaier
Copy link
Member Author

@FlorianKirmaier FlorianKirmaier commented Sep 19, 2021

For the strange reason, why i haven't used a lambda for the test, I've created another ticket: https://bugs.openjdk.java.net/browse/JDK-8273970

@openjdk openjdk bot added the rfr label Sep 19, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 19, 2021

Webrevs

@tomsontom
Copy link
Collaborator

@tomsontom tomsontom commented Sep 20, 2021

For the strange reason, why i haven't used a lambda for the test, I've created another ticket: https://bugs.openjdk.java.net/browse/JDK-8273970

I dpn't think this is a bug - none capturing lambdas are instantiated once and you reuse that instance for all time - the JLS allows this https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.27.4

@FlorianKirmaier
Copy link
Member Author

@FlorianKirmaier FlorianKirmaier commented Sep 20, 2021

I guess that makes sense - but I can think of a million ways to create nearly unsolvable problems with it.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

The fix looks obviously correct. I verified that the test catches the bug (fails without the fix and passes with the fix). I left a few cleanup comments on the test.

Btw, I almost left an additional test comment about needing to wait for the Runnable to be called (e.g., by waiting for a latch that is triggered in the Runnable), but I realized that this is unnecessary given that the test waits for the Runnable to be garbage-collected, which can't happen until after the run method of the Runnable has been called.

One last suggestion is that I recommend to change "Lambda" to "Runnable" in the title of the bug (and thus the PR).

@FlorianKirmaier FlorianKirmaier changed the title 8273969: Memory Leak on the Lambda provided to Platform.startup 8273969: Memory Leak on the Runnable provided to Platform.startup Sep 22, 2021
Some changes based on code review
@openjdk
Copy link

@openjdk openjdk bot commented Sep 22, 2021

@FlorianKirmaier 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:

8273969: Memory Leak on the Runnable provided to Platform.startup

Reviewed-by: 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 3 new commits pushed to the master branch:

  • 338b999: 8273946: Move clearQuad method to BaseShaderGraphics superclass
  • 5c355fa: 8090158: Wrong implementation of adjustValue in scrollBars
  • f59a057: 8090547: Allow for transparent backgrounds in WebView

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth) 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 label Sep 22, 2021
@FlorianKirmaier
Copy link
Member Author

@FlorianKirmaier FlorianKirmaier commented Sep 23, 2021

/integrate

@openjdk openjdk bot added the sponsor label Sep 23, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

@FlorianKirmaier
Your change (at version 9620ed5) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented Sep 23, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

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

  • 338b999: 8273946: Move clearQuad method to BaseShaderGraphics superclass
  • 5c355fa: 8090158: Wrong implementation of adjustValue in scrollBars
  • f59a057: 8090547: Allow for transparent backgrounds in WebView

Your commit was automatically rebased without conflicts.

@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

@kevinrushforth @FlorianKirmaier Pushed as commit 4b9cb21.

💡 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
3 participants