Cheat Sheets

System - No Panic on OOM

Description

/proc/sys/vm/panic_on_oom is to be 0. /proc/sys/vm/overcommit_memory is to be 2. This is usually NOT a good idea because an OOM situation causes undefined behaviour.

Solution

echo 'vm.panic_on_oom = 0' >/etc/sysctl.d/50-vm.panic_on_oom.conf; echo 'vm.overcommit_memory = 2' >/etc/sysctl.d/50-vm.overcommit_memory.conf; sysctl -p

Check Script: system-no-oom-panic.sh

#!/bin/bash

if [[ $(/sbin/sysctl -n vm.panic_on_oom 2>/dev/null) != "0" ]]; then result_failed "sysctl vm.panic_on_oom != 0" fi if [[ $(/sbin/sysctl -n vm.overcommit_memory 2>/dev/null) != "2" ]]; then result_failed "sysctl vm.overcommit_memory != 2" fi
Comment on Disqus