javaperformancetomcatheap-memoryjava-melody

Javamelody Counter instance taking up a lot of space


We have a module deployed on tomcat 7 in production and using javamelody 1.49.0 to analyze performance.

Our infrastructure team reported an issue in production where Javamelody's Counter seemed to take around 900 MB potentially due to a memory leak. is this a known issue. It happens after few days of usage like every other week and we do NOT know what is causing this.

Does anyone have an idea on this ?

Error message from heapdump production


Solution

  • We recently had this exact same issue because we had mis-configured the javamelody.storage-directory.

    JavaMelody logs someting like: exception while collecting data: java.io.IOException: JavaMelody directory can't be created: /path/to/storage/dir/_4814f02a7626 in the logs section of the web-interface.

    It appears that Java Melody keeps all request data in memory when it is unable to write its data to the storage location causing this massive memory leak. This memory leak turns up in the heap dump as an huge instance of class net.bull.javamelody.internal.model.Counter.