Problem: High CPU Load of a Single Samba Process

Problem

On a UCS 4.2 system every now and then a Samba process shows very high CPU load (around 100% permanently) causing other processes to slow down.

Environment

By using the strace command on the process ID (pid) (here: 2382) of the Samba process the output looks like this:

root@ucs:~# strace -p2382 -f
fcntl(11, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=34904, len=1}) = 0
fcntl(11, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=34904, len=1}) = 0
fcntl(11, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=918577468, len=1}) = 0
fcntl(11, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=81916004, len=1}) = 0
fcntl(11, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=34904, len=1}) = 0

So Samba is permanently accessing file descriptor “11”. Search for the file which is referenced by this descriptor:

root@ucs:~# ls -al /proc/2382/fd/11
 lrwx------ 1 root root 64 Mai 8 19:20 /proc/2382/fd/11 ->  /var/lib/samba/private/sam.ldb.d/DC=SUB,DC=DOMAIN,DC=DE.ldb

According to this Samba bug it is a known problem resulting from a non performant access to the Samba database files.

Solution

Upgrade to UCS 4.3 which ships updated Samba 4.7 by default.

Mastodon