-
Notifications
You must be signed in to change notification settings - Fork 493
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
8349105: Pagination: exception initializing in a background thread #1698
base: master
Are you sure you want to change the base?
8349105: Pagination: exception initializing in a background thread #1698
Conversation
👋 Welcome back angorya! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Webrevs
|
/reviewers 2 |
@kevinrushforth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test runs out of heap space for me on Windows with or without your fix using the default heap size. This may point to a leak, although bumping up the memory causes it to pass with your fix.
The fix looks good, although the test doesn't catch the bug most of the time (even when bumping up the heap).
This may be a memory leak, or it could simply be expected - after all, it is a stress test and we do create heavy objects in a tight loop. I think it's worth investigating in the context of this ticket. Thank you! |
Yep, it does needs to be investigated for this PR, since we can't enable a test that will cause OOM when running the tests normally. I'll be interested to know what you find. |
I am unable to reproduce OOM on Windows 11 with the fix (I did see the OOM earlier when it was failing before the fix). I've tried the unmodified test, as well as the extended version with the DURATION doubled to 10 seconds and added A cursory look at the Pagination/PaginationSkin code reveals no obvious candidates for memory leaks. Maybe try running it again, now that it has the text layout fixes as well? |
I still see the OOM. Are you running it from gradle? Here is the command line that will reproduce it, after first building with: "
|
I also see the OOM on Mac. |
I see the problem with gradle (I was running it in Eclipse). We apparently set |
The default is set by the gradle installation itself, which is not controlled by us. I know you can bump the memory with a gradle option on the command line (which we do for our CI builds, but we just set it to 512Mb). We can trivially change our CI test script, but I'd be hesitant to require every developer to set that on the command line. A better solution might be to set the max heap to 1Gb in the system tests project in |
|
A quick test suggests that there is still something up with Pagination that increasing the memory won't fully resolve. Even bumping it up to 2Gb fails sometimes on my Mac (e.g., if I increase the duration to 10 sec). I added More study is needed, so let's pick this up next week. |
it looks like the amount of garbage generated during this test exceeds the ability of gc to collect it. adding System.gc() to the test allows it to run even after -Xmx500m, though I still would like to increase the heap size in JDK-8349679 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the explicit call to System.gc()
this now passes for me. I was also able to reproduce the failure without your fix using the latest version of the test, and confirm that it passes with your fix.
I think the frequency of calling System.gc()
is probably too high. Perhaps calling it every 10 or 100 times through the loop would suffice (and then it would be a better stress test of object allocation, since System.gc() effectively introduces delay)? That might be difficult to do without modifying the test
method, so we could consider this for a follow-up.
Somewhat related, I'm convinced that there is a leak somewhere. If I run just the pagination test for 100 seconds rather than 5, it's easy to see that the memory keeps growing -- with or without the fix for this bug. We should file a follow-up bug for this.
You are probably right about For the OOME - there seems to be no leak, since the memory usage drops down to initial values either using (we also have no leak detected in the skin test and no memory issues logged against Pagination in JBS) |
it still might be worth a follow-up bug. As it is, calling
When I run it with |
Created https://bugs.openjdk.org/browse/JDK-8349750 placeholder for collecting follow-up issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed JDK-8349756 to track the leak. I think the call to System.gc()
is effective only because it slows down the tight loop.
// this test generates a lot of garbage quickly | ||
if (nextBoolean(0.1)) { | ||
System.gc(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While investigation the Pagination leak I also took a closer look at this System.gc()
. The reason this prevents the OOM has nothing to do with the GC per se, but rather it slows the loops down so much that they don't generate nearly as much garbage in the 5 seconds the test runs in. You can verify that yourself by replacing the System.gc()
with sleep(10)
or similar (depending on the speed of your system), and get the same effect.
I don't think there is a good reason to call System.gc()
at all in this loop. Once the leak is fixed, it should run fine at full speed.
Please review #1705 before this one. |
|
For testing purposes, merged this PR with the memory leak fix #1705 . Once the latter is integrated, unrelated changes will disappear. |
Root Cause
Animation gets started in a background thread, which causes the animation handler to run in the FX application thread, thus creating simultaneous access to the control's fields (list of children in this case).
Solution
Postpone the animation unless running in the FX application thread. There is no functional difference if the component is created/used in the FX application thread.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1698/head:pull/1698
$ git checkout pull/1698
Update a local copy of the PR:
$ git checkout pull/1698
$ git pull https://git.openjdk.org/jfx.git pull/1698/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1698
View PR using the GUI difftool:
$ git pr show -t 1698
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1698.diff
Using Webrev
Link to Webrev Comment