Problem
You PostgreSQL service stops nightly.
Environment
Package database app installed with PostgreSQL
In kernel.log or syslog you see messages about “Out of Memory” (oom).
8GB of RAM, 1GB of swap configured.
Multiple UCS servers
Every UCS system in the domain updates the package database on the server based on a schedule. Every night at 01:05 the servers update their data. A jitter of 300 is configured to spread the start of the update and lower the load on the package database.
Solution
Option 1: Increase the jitter
In this case the systems have a broader windows to start which will prevent to close starts of the updates:
Set the UCR variable to use a longer jitter (ie 1,500) instead of the defaul value of 300:
ucr set cron/pkgdb-scan/command: /usr/sbin/jitter 1500 /usr/sbin/univention-pkgdb-scan --scan >/dev/null 2>&1
Option 2: Increase swap memory.
This will eventually prevent out-of-memory failures but it might slow down your system to nearly unresponsive. Test if it works for your environment and make sure you have enough disk space on / available. Otherwise fit the path to your environment.
root@ucs:~# dd if=/dev/zero of=/swapfile bs=1G count=16
root@ucs:~# mkswap /swapfile
root@ucs:~# chmod 0600 /swapfile
root@ucs:~# echo “/swapfile none swap sw 0 0” >> /etc/fstab
root@ucs:~# swapon -a
Option 3: Prevent Kernel Memory Overcommitment
This might help but is unconfirmed to work for now.
See facts about Kernel overcommit.
Append two lines to /etc/sysctl.conf
:
vm.overcommit_memory=2
vm.overcommit_ratio=50
Update the changes:
root@ucs:~# sysctl -p