Out of Memory Info in System Log

If a pico server instyance runs out of memory during, for example, a system import, the System Log might not be properly updated with the out of memory information. To make sure that this critical error information is properly stored in System Log, an oom script is run each time an OutOfMemoryError exception is thrown. The JVM is started using the -XX:OnOutOfMemoryError=oom flag, which enables the JVM to catch all OutOfMemoryError exceptions from the oom script.

OOM Script

The oom script uses three parameters to generate output:

  • $1 - the name of the running pico process, for example, ec1 or platform, where the OutOfMemoryError occurred
  • $2 - the regular log file, for example ec1.log or platform.log, where further information is stored

  • $3 - the name of the critical error log file where the OutOfMemoryError info ($1 and $2) is added, together with current time and hostname

    The name of the critical error log file is, in case of a platform process, platform_criticalerror.log and, in case of an EC process, for example, ec1_criticalerror.log.


Note!

It is not allowed to update the oom script to return any other info, since this might cause the logging to System Log to fail or incorrect info will be included in System Log.


Each time the platform or an EC is restarted, the contents of the critical error log will be added to the System Log (one line per OutOfMemoryError occasion) and the critical error log will then be removed.

Example - OOM info in the Critical Error Log

Tue Jan 17 17:21:11 CET 2012 OutOfMemoryError on ec1at host-e6410. See ec1.log for more information

User Defined Script

It is possible to use a user defined script for sending, for example, e-mail notifications related to the OutOfMemoryError exception. This script must be called user_oom and located in MZ_HOME/bin. If user_oom is available, the oom script will call it and forward the $1 and $2 parameter values.