I tried installing slapd on the following images :
images:ubuntu/artful/amd64
images:debian/strech/amd64
ubuntu:xenial/amd64
images:debian/jessie/amd64
The problem is present in both Ubuntu images but only in the Stretch one.
Indeed in the Jessie image slapd is consuming around 45 MB of memory, which sounds correct.
All i’m doing is just launching the image and then “apt install slapd”, then look at memory consumption.
I have done a quick test with LXD installed from snapd and launch a xenial container.
Before I set the ulimit -n 1024 and run slapd on the same console I get this on /var/log/syslog
Jan 5 23:12:12 c1 slapd[1250]: @(#) $OpenLDAP: slapd (Ubuntu) (May 30 2017 19:20:53) $#012#011buildd@lgw01-18:/build/openldap-JXEADB/openldap-2.4.42+dfsg/debian/build/servers/slapd
Jan 5 23:12:12 c1 slapd[1251]: ch_calloc of 1048576 elems of 704 bytes failed
Jan 5 23:12:12 c1 systemd[1]: Starting Apport crash forwarding receiver...
Jan 5 23:12:12 c1 systemd[1]: Started Apport crash forwarding receiver.
Jan 5 23:14:07 c1 slapd: slapd stopped.
Jan 5 23:14:07 c1 slapd: connections_destroy: nothing to destroy.
Jan 5 23:14:10 c1 slapd: slapd stopped.
Jan 5 23:14:10 c1 slapd: connections_destroy: nothing to destroy.
After I set ulimit -n 1024 and run slapd on that same console the daemon starts correctly
Jan 5 23:14:15 c1 slapd[1266]: @(#) $OpenLDAP: slapd (Ubuntu) (May 30 2017 19:20:53) $#012#011buildd@lgw01-18:/build/openldap-JXEADB/openldap-2.4.42+dfsg/debian/build/servers/slapd
Jan 5 23:14:15 c1 slapd[1267]: slapd starting
I’m running LXD from packages/repo and not from snap and i can’t change this for the moment.
My ulimit -n is already set to 1024 :
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127967
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
I have no problem starting the daemon, and thus i don’t get this error “ch_calloc of 1048576 elems of 704 bytes failed”.
Slapd isn’t complaining at all.
But are you running slapd from that same console? Because if you are running through a script or via another user the ulimit is gonna be different if you do not set it properly via /etc/security/limits.conf
I have launched a vm with 17.10, install lxd via apt (2.18) launched a xenial container and run the same steps, I have the same output as I described before. so it seems for now that you are not setting ulimit -n properly for slapd to be able to run.