Closed jmkao closed 8 years ago
I don't think you uploaded the hprof file, it seems to be a web capture of the dominator tree. Don't worry about it though, if it's 100% reproducible, I can get my own dump.
To answer your question, I haven't seen this before. My first guess is that this is a side effect of mocking InputStreams with PowerMock. First step is to see if a single test is responsible for all of this chaos or if it's a cumulative problem over the course of several tests. I'll start by narrowing out HexCodeBasedProjectorTesting and moving on from there.
I did a quick test. I'm not able to reproduce this on Windows until I put the limit down to 64m. That's pretty low mem, but I'm assuming I'm reproducing your exact issue.
I've also conclusively narrowed it down to the test: org.area515.resinprinter.projector.HexCodeBasedProjectorTesting.noJSONErrorsAndJavaScriptAutodetectProjectors()
That test won't run under 64m, but all other tests combined will run under 64m. I should be able to figure this out pretty easy now. I'll check it out further tomorrow.
The method I was calling was pretty pointless. There is a larger issue at play with your JVM, but it isn't worth tackling now. I just checked that in.
Good enough :). This does does seem to manifest repeatably on 64-bit x86 Linux JVMs, both on my Linux box and in Travis, but not on Windows. Not sure why it's OS dependent; those are the hardest to figure out.
I'm trying to stabilize the execution of tests in Travis CI and was running into an intermittent problem where Travis would kill the test runner causing the build to fail.
Upon further investigation, it seems that the documented memory allocation for the Docker container in Travis is 4GB, and the behavior of Linux cgroups resource control (that Docker is built on top of) will kill processes that exceed the allocated memory. Running on my local Linux box, it seems that the test suite will consume just around 4GB (sometimes a little more, sometimes a little less) during its run.
Constraining the
-Xmx
to 1GB, the test will fail duringHexCodeBasedProjectorTesting
consistently with the GC overhead exceeded (interestingly not running out of memory):I took a heap dump during the stage of the test where it consumes large amounts of memory, and the Dominator tree shows that the Finalizer is holding onto a mock object proxy for
org.area515.resinprinter.serial.SerialCommunicationsPort
which then holds onto a vast quantity (about 1.9 million) of LinkedList objects. From what I can tell, this isn't a memory leak so much as an extremely high volume of short-lived allocations that outpaces the garbage collector's ability to clean up until around the 4GB usage level. Capping the heap does not result in the JVM running out of memory, but the excessive amount of GC causes the JVM to throw a "GC Overhead Exceeded" type of OOM.@WesGilster I'm not very familiar with Mockito and whether this particular mock object (
org.area515.resinprinter.serial.SerialCommunicationsPort
) might be configured to store some temporary state. And if so, why it would have so many invocations to it. Some of theLinkedList
entries look like serial commands (e.g.* 0 Lamp ?.
), but others are Object arrays containingint[]
's andshort[]
's:But I'm also not really that familiar with the serial port handling code. Any ideas?
TestDominatorReport.zip