-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Executing large number of dynamic tests results in OutOfMemoryError: GC overhead limit exceeded #1445
Comments
Thanks for verifying that you encounter similar behavior with the We'll look into it. |
Tentatively assigned to the 5.3 backlog for team discussion |
Before we investigate, could you please tell us the memory and GC configuration you are using to launch the JVM when executing these tests? |
I have tried running the provided test code on the current master and my conclusion is that trying to run such number of tests is expected for the platform to run out of memory. The platform is storing all generated So I have done 2 things a) investigated a heap dump using visualvm to see if we are keeping references to information that we no longer need, or intermediate computations but was not able to find anything to suggest a 'memory leak' b) run the dynamic tests to see whether we have an effectively constant memory need for each dynamic test or if we grow non-linearly. My results suggest the memory need for each dynamic test is effectively constant. Here are my results:
If we actually need/want to support unlimited number of tests then the current 2-step model of 1) running and storing all the information and 2) process the stored results will always cause the platform to eventually run out of memory. @junit-team/junit-lambda Have you guys pondered on this issue before? |
@gaganis Thanks for the excellent analysis! We'll discuss this issue in the team. I think there's certainly room for improvement but I don't see us moving away from the 2-step model. |
One thing that stood out to me while I was looking into this, is how verbose the And we also keep both the id and the parentId they do take up quite a few bytes. An example identifier from the example contains these:
So these in Java 9 with compacted strings these would require almost a quarter of a KB and almost half a KB in Java 8(without compaction). This identifier format is very practical from a human readability perspective and it could also be parseable. If the format of these ids is purely internal to the platform and is not used/expected by other tools then we could examine if it would make sense to adopt a sorter form. |
Base 64 encoding? 😝 |
All kidding aside, when the issue was first raised I actually assumed the combined tracking of all test identifiers and test descriptors could be one of the culprits. |
Out of curiosity, did you see anything alarming with regard to annotation caching in I'd be interested in knowing if that causes any issues, especially since that cache is currently unbounded. |
Oh wait... the annotation cache could never be an issue if all that's run are dynamic tests. We'd need an actual, realistic, large test suite to see any issues there. 😉 |
I saw no issues there :)
I can see why you are worried after taking a look at the code. This cache has no size limit. :) |
Mmmmmm... I've always pondered converting that to a bounded cache with an LRU eviction policy (like I did with the application context caching in the Spring TestContext Framework). Maybe I really should do that. 🤔 |
Voila! |
@marcphilipp , do you think something like I see you don't want to maintain property-based testing solution, however, it does sound weird that It would be nice if property-based testing could be integrated with It looks like the ability to selectively disable storing of all the individual results would be beneficial for both regular JUnit5 users (== avoid storing individual see jqwik-team/jqwik#84 |
I'd be okay with adding an option to |
I created a draft PR with a bunch of improvements. /cc @ben-manes |
I'm not sure why, but I find the result of this exciting! Great work, @marcphilipp. 👏 |
Thanks! 😊 |
Wow, really great work! As a former colleague of @vinayf I can really appreciate that, even though the project where we came up with it is a thing of the past. |
Overview
When trying to run a large number of dynamic tests the framework throws an out of memory error.
For the sake of simplicity, below is a sample test I ran.
I have run this using both
ConsoleLauncher
andmaven-surefire-plugin
2.21.0, but both approaches give the same problem. Below is the error.Versions
Use Case
I am writing a small application to find and report differences between two databases and am generating a dynamic test for each db row for comparison.
The text was updated successfully, but these errors were encountered: