Sometimes to avoid OOM errors we need to configure Overload protection where the server JVm will exit on some threshold overload and Node manager will restart the server.
Please follow below steps to configure the same.
1. Login to Admin Console > Servers > NameOfServer >Configuration > Overload > Failure Action=Force immediate shutdown of the server and Panic Action=Exit the server process .
2. Save/Release the lock the configuration.
3. Make sure you have configurations like below in config.xml:
<overload-protection> <shared-capacity-for-work-managers>65536</shared-capacity-for-work-managers> <panic-action>system-exit</panic-action> <failure-action>force-shutdown</failure-action> <free-memory-percent-high-threshold>0</free-memory-percent-high-threshold> <free-memory-percent-low-threshold>0</free-memory-percent-low-threshold> <server-failure-trigger> <max-stuck-thread-time>600</max-stuck-thread-time> <stuck-thread-count>0</stuck-thread-count> </server-failure-trigger> </overload-protection>
4. Ideally, as the Panic Action is set as System-exit, the server should shutdown on OOM(OutOfMemory) Error and process should exit.
but sometimes its seen it does not work as expected so in this kind of cases we can add few more JVM parameters which can do the Job if not done by WLS itself.
5. You can use Jrockit jvm flag ExitOnOutOfMemoryError
Enter this command at startup to force JRockit JVM to exit on the first occurrence of an out of memory error.
Which exits the JVM process. (If NodeManager configured and server was started under the control of the NodeManager, Node Manager restarts the server)
Also AutoRestart property in Node Manager properties file Must be true
Also ensure that the NodeManager is configured and the weblogic server also must have started with NodeManager.
Check the documentation on these properties
AutoRestart – Specifies whether Node Manager can automatically restart this server if it fails
AutoKillIfFailed – Specifies whether Node Manager should automatically kill the server if its health status is failed