Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java replay log, diagnosing out of memory error

We are running a Java 8 application with a JNI layer which has crashed due to an Out of Memory Error somewhere in the C layer.

Along with the usual hs_err_pid.log file, we have noticed this time that we've also received a replay_pid.log file. I've done some extensive Google-foo and can barely find anything about this file.

Has anyone seen this file before, and does anyone know what it contains and how best to analyse it?

like image 706
Bob Davies Avatar asked Nov 17 '15 14:11

Bob Davies


1 Answers

The file is generated by the java hotspot to gives replay information about the operations at the time of the issue occurring. Whether or not it gives you anything specific enough to tell you where the issue is seems to be hit or miss, but it does help tell you what was going on in general at the time.

There was a similar issue reported under OpenJDK about the replay file being generated after a segmentation fault occurred. The issue was said to be fixed with a later build, so if you are using a version less than 8u40, I would upgrade and see if that fixes the issue. (issue as reported)

If not, then you will have to start digging through your C/C++ files, figuring out what is causing the seg fault. Since you are using JNI, one thing to remember (and pardon me if you're aware) is that if you make a call in Java through JNI to C/C++ and then in that call, allocate any memory, that memory allocation is not freed up when your Java object is garbage collected. You have to manually free up the allocated memory. If a function makes numerous calls to the same C/C++ class and each time it allocates more memory, then eventually you will end up with this issue.

like image 169
John Avatar answered Oct 19 '22 04:10

John