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
EasyMock 5.0.1 OOM on large project #338
Comments
Thanks for the feedback. I will try to reproduce. But can you please look at the GC root of the Method instance? |
Thanks. You can download the heap dump (670MB, yikes) from https://mivoter.org/core. Attempting to attach a screenshot of the gc root display. It's been a long time since I used jvisualvm, so not sure how much analysis I'm capable of. |
We can confirm this issue with EasyMock 5.0.1. Heap shows many instances of
Feel free to let us know if there is any additional information we can provide, that might help. |
I am unsure if it is related but this article on ByteBuddy references a possible memory leak if the proxied classes are cached:
|
I have started to look at it and I tried the TypeCache from ByteBuddy to fix it. However, there's something that sticks between mocks extending the same class. So I need to look a bit more into it. I'll push a branch if someone wants to have a look |
I have created a branch named typecache showing the issue. |
@henri-tremblay What's wrong with my PR for type caching ? All tests (including new tests in ClassProxyFactoryTest from typecache branch) passes fine with it. |
It's fine now. I think I can merge and release. I will find the time during Christmas. |
@henri-tremblay Thanks so much! Will this be in 5.0.2? Or is there a public checkout available of this fix? I'd love to try it on our 22,000+ test base, and report back. Also, do you have a coffee/pizza/whatever fund? :-) |
It's EasyMock 5.1.0. Let me see for the pizza :-) |
We updated to 5.1.0 and on the build server (Jenkins on Linux) with:
Everything was fine. However, on local Windows machines with:
We (still) get:
The issue goes away when downgrading to EasyMock 4.3. Is anyone experiencing similar issues? |
Our large (22K tests) codebase "worked" under EasyMock 5.0.1, but threw OOMS as noted earlier. I just tried 5.1.0 today, and now I have many tests failing, e.g. ... and that line (58) is just calling createMock with a controller (from EasyMock.createControl()). |
@henri-tremblay Note that 5.1.0 is still failing. I suggest this is not "closed" (unless there's a different ticket for 5.1.0). This is Java 11 (Corretto) with Gradle 5, on both Windows 10 and Oracle Linux 8. |
We have a very large Java 11 project, using easymock 4.3, that has tons of illegal accesses. (I.e. many many tests fail when we enable --illegal-access=deny.) Everything works fine right now, we're just looking ahead to the future (i.e. Java 17, when 'deny' becomes the default.)
Building with easymock 5.0.1, the build (gradle 5) OOMs after running the first ~11,000 tests. (There are 20,000+). Watching the CPU, looks like a clear sign of thrashing/memory leak, as the # of tests run increases. Telling our gradle build to fork a new JVM every 100 test classes makes everything work OK, but slower.
I grabbed a heap dump shortly before the OOM -- all 667MB of it -- and I see 1.5M instances of "java.lang.reflect.Method", which seems unusual, to say the least.
I don't know how to diagnose this further, but it certainly smells like a memory leak in/around easymock 5. I can post the heap dump file somewhere public if that is useful. Or happy to perform any other experiments as suggested.
Sorry to be so vague, but I wanted to offer everything we know at the moment. The Gradle "forkEvery" option will work for us, but wanted to post the issue in case it is useful.
The text was updated successfully, but these errors were encountered: