OutOfMemoryError and creating Java core Heap dumps
See below lines:
root@Aixr:/opt/snow#/usr/java8_64/jre/bin/java -jar /opt/snow/snowagent.jar scan
JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2020/11/27 11:44:45 - please wait.
JVMDUMP032I JVM requested System dump using '/opt/snow/core.20201127.114445.16646332.0001.dmp' in response to an event
Note: "Enable full CORE dump" in smit is set to FALSE and as a result there will be limited threading information in core file.
JVMDUMP010I Java dump written to /opt/snow/javacore.20201127.114445.16646332.0003.txt
JVMDUMP032I JVM requested Snap dump using '/opt/snow/Snap.20201127.114445.16646332.0004.trc' in response to an event
JVMDUMP010I Snap dump written to /opt/snow/Snap.20201127.114445.16646332.0004.trc
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2020/11/27 11:44:56 - please wait.
JVMDUMP032I JVM requested Heap dump using '/opt/snow/heapdump.20201127.114456.16646332.0005.phd' in response to an event
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.io.File.list(File.java:1133)
at java.io.File.listFiles(File.java:1297)
at se.snow.common.FileHelper.getFileListingNoSort(FileHelper.java:250)
at se.snow.common.FileHelper.getFileListingNoSort(FileHelper.java:255)
Snow Agent for Unix, all versions
This happens when not enough memory gets allocated to Java in order for the Snow Agent to carry out the scan.
When this happens, the issue is not with Snow Agent but how Java has defined certain values to be the default. This parameter however can be changed to suit the needs of the application.
To better understand more about the OutOfMemoryException please read this
The first thing to look at is the configured scan path in snowagent.config and be more selective. In particular we do not recommend scanning from the root directory in large environments.
Also check that we're not scanning NFS mounts as this can be very resource intensive.
Finally, if you want to allocate more memory to the Java process, we can use the Xmx option on the Java commandline:
First try setting the process to allocate 2GB:
/usr/java8_64/jre/bin/java -Xmx2G -jar /opt/snow/snowagent.jar scan
This will set the allocated memory for the java process to 2GB. Should the agent scan still fail you can add more memory as needed.
Once you have found the sweet spot, this will need to be reflected in the crontab, like so:
0 21 * * * nice -n 10 /usr/java8_64/jre/bin/java -Xmx2G -jar /opt/snow/snowagent.jar -w /opt/snow/ >/dev/null 2>&1
NOTE: Change the correct path of the java designated on your environment.
Insufficient memory in the Java process to complete scan.