Loading…
Loading documentation...
Investigate OOM exit code 137 crashes, high iowait stalls, and full filesystems while tuning Linux sysctl memory maps, overcommit, and SYN flood guards.
Commands checked on 2026-11-23 with Linux Kernel 6.8+, Docker 27+, Ubuntu 24.04 LTS, Debian 12.
A systematic first-five-minutes diagnostic workflow to pinpoint OOM-killed containers (exit code 137), iowait bottlenecks, exhausted filesystems or inodes, and a tuned /etc/sysctl.d/99-production.conf baseline for databases and vector engines.
sudo; see Administer Ubuntu, Debian, Rocky, and AlmaLinux servers cleanly.docker logs) and systemd units (journalctl).Exit code 137 (128 + 9 SIGKILL) almost always means the Linux kernel or cgroup memory limit killed the process:
dmesg -T | grep -iE 'killed process|out of memory|oom-kill' | tail -n 20
docker ps -a --format "table {{.Names}}\t{{.Status}}"
docker inspect --format '{{.Name}} OOMKilled={{.State.OOMKilled}} ExitCode={{.State.ExitCode}}' $(docker ps -aq) 2>/dev/null || true
free -m
swapon --show
High load average with low %usr CPU and high %wa points to storage contention, swapping, or unindexed DB writes:
vmstat 1 5
iostat -xz 1 3 2>/dev/null || sar -d 1 3 2>/dev/null || top -b -n 1 | head -n 20
sudo ss -s
cat /proc/sys/fs/file-nr
Sometimes df -h shows 100% used even after deleting large log files because a running daemon holds the deleted file handle open ((deleted)):
df -hT
df -i
sudo lsof +L1 2>/dev/null | head -n 25
sudo du -xhd 1 /var/lib /var/log 2>/dev/null | sort -h
docker system df 2>/dev/null || true
Reloading or restarting the process holding a deleted log releases the reclaimed disk blocks immediately; clean unused images cautiously with docker image prune -a --filter "until=168h".
Vector databases (Qdrant), search engines (Meilisearch, OpenSearch), and in-memory stores (Valkey/Redis) require higher vm.max_map_count and predictable overcommit behavior alongside network hardening:
sudo tee /etc/sysctl.d/99-production.conf >/dev/null <<'EOF'
# Memory and mmap tuning (PostgreSQL, Valkey, Qdrant, Meilisearch)
vm.overcommit_memory = 1
vm.max_map_count = 1048576
vm.swappiness = 10
# Kernel & Network Hardening
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 4096
kernel.kptr_restrict = 2
kernel.randomize_va_space = 2
EOF
sudo sysctl --system
THP increases latency tails and fork memory usage during RDB background saves. Create a lightweight systemd oneshot unit so THP remains never across reboots:
cat /sys/kernel/mm/transparent_hugepage/enabled
sudo tee /etc/systemd/system/disable-thp.service >/dev/null <<'EOF'
[Unit]
Description=Disable Transparent Huge Pages for Databases
Before=docker.service postgresql.service valkey-server.service redis-server.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled && echo never > /sys/kernel/mm/transparent_hugepage/defrag'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now disable-thp.service
Verify applied kernel sysctls and THP state:
sysctl vm.overcommit_memory vm.max_map_count vm.swappiness net.ipv4.tcp_syncookies
cat /sys/kernel/mm/transparent_hugepage/enabled
You should see 1, 1048576, 10, 1, and always madvise [never].
deploy.resources.limits.memory or JVM -Xmx / Node --max-old-space-size mismatch is hitting a cgroup cap. Size Node heap to 70–75% of the container limit (NODE_OPTIONS=--max-old-space-size=1536 inside a 2G container).sysctl --system warns cannot stat /proc/sys/net/ipv6/.... IPv6 is disabled at boot; comment the IPv6 line or prefix with -net.ipv6... in sysctl drop-ins so boot never flags an error.docker volume rm or delete pg_wal/. Expand storage or free /var/lib/docker/overlay2 / old logs first, then start Postgres so crash recovery replays WAL cleanly.mem_limit / deploy.resources.limits.memory on every Node.js, Python, and Java container so one memory leak cannot starve sshd or PostgreSQL.Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.