Troubleshooting
mlock Issues
EPERM: Operation not permitted
Cause: Missing CAP_IPC_LOCK capability.
Solution:
# Docker
docker run --cap-add=IPC_LOCK ...
# systemd
AmbientCapabilities=CAP_IPC_LOCK
# setcap
sudo setcap cap_ipc_lock+ep /usr/bin/my-daemon
ENOMEM: Cannot allocate memory
Cause: Memlock ulimit exceeded.
Solution:
# Docker
docker run --ulimit memlock=-1:-1 ...
# systemd
LimitMEMLOCK=infinity
# shell
ulimit -l unlimited
Container Issues
Daemon deadlocks under memory pressure
Cause: Memory not locked, daemon pages being swapped.
Solution:
docker run --cap-add=IPC_LOCK --ulimit memlock=-1:-1 ...
See Memory Locking for full details.
General Issues
Daemon fails to start
- Check logs:
journalctl -u my-daemon - Verify configuration:
my-daemon --check-config - Check permissions on binary and config files
- Verify resource limits are reasonable
High memory usage
- Check for memory leaks with
heaptrackorvalgrind - Review
VmRSSin/proc/<pid>/status - Ensure mlock is not locking more than needed