You are not logged in.

#1 2017-01-28 14:42:46

eomanis
Member
Registered: 2013-04-17
Posts: 50

[SOLVED] Samba: Client causes high CPU load on server after standby

@update 2017-05-04
This regression in linux has been fixed as of linux-4.10.13-1

@update 2017-02-06:
I am better informed now. My Arch workstation PC is DoSing my home server. Why you little...!

The shares are mounted with /etc/fstab lines like that one:

//homeserver/networkdrive  /media/homeserver.networkdrive  cifs  rw,nounix,uid=1000,gid=1000,dir_mode=0770,file_mode=0660,user=XXXXX,password=XXXXX  0  0

The madness always begins when I wake up my workstation PC from standby.
For now I always run "su -c 'umount /media/homeserver.*; mount -a' root" after waking it up and after that everything is fine again, until the next wake-up from standby. Wat.

The kernel is handling Samba client mounts like these, right?
I don't see anything in "journalctl -b 0 -k" as root on my workstation though.


@update 2017-01-28:
It seems to have stopped ... but I am none the wiser. Huh.
Close enough I guess. I'll take it.
On the off-chance that it has anything to do with it, the log level is now set to 2.


So I looked at my home server today, and all of its 4 cores are floored.
htop says that /usr/bin/smbd -D is the one having the CPU party, and right enough, when I systemctl stop smbd.service the CPU load goes away.

My shares appear to function from the clients' side of view while smbd.service is running and burning all these CPU cycles.

I am not aware of any client putting heavy load on my shares.
Raising the /etc/samba/smb.conf log level to 3 and viewing journalctl -b 0 -u smbd.service does not show anything conspicuous.

Now, it's winter here, so whatever the server is using in extra electricity I possibly save in heating costs, but still, I deem it unnecessary seeing the cores at over 70°C on a server that should be almost idling.

The server runs linux-lts on x86_64 in version 4.4.45-1, although earlier today the problem was already there with linux-lts 4.4.44-1.
The version of the installed samba package is 4.5.4-1.

My /etc/samba/smb.conf looks like that:

[global]
    server role            = standalone
    security               = user
    encrypt passwords      = Yes
    username map           = /etc/samba/smbusers
    passdb backend         = tdbsam:/etc/samba/private/passdb.tdb
    invalid users          = root

    guest account          = smbguest

    workgroup              = WORKGROUP
    server string          =
    hosts allow            = 127.0.0.0/8, 192.168.0.0/24
    interfaces             = 192.168.0.33/24
    name resolve order     = wins, lmhosts, hosts, bcast
    wins support           = Yes
    dns proxy              = No

    log level              = 1
    logging                = systemd

[someShare]
    path                   = /path/to/someShare
    follow symlinks        = No
    read only              = No
    create mask            = 0600
    directory mask         = 0700

(Some more shares like someShare)

Anybody else seeing this kind of thing with Samba?

@update:
I've raised the log level to 6 for a short time, but didn't see anything meaningful either. The only effect was a net reduction in combined CPU usage because journald was struggling to write the logs using a single core and was apparently slowing down smbd in the process.

Last edited by eomanis (2017-05-04 16:40:03)

Offline

#2 2017-02-06 18:07:00

eomanis
Member
Registered: 2013-04-17
Posts: 50

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

Apparently edits don't actually change the "most recent post in thread" time stamp. Bump.

Offline

#3 2017-02-06 19:51:38

deadite66
Member
Registered: 2015-06-13
Posts: 32

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

yes i had same problem in ubuntu and now when i'm using arch.

for now i have script i run on my client machine to unmount and remount them, i'd like to try autofs again as it has timeouts, couldn't get it working in ubuntu.

Last edited by deadite66 (2017-02-06 19:54:08)

Offline

#4 2017-02-06 23:12:58

eomanis
Member
Registered: 2013-04-17
Posts: 50

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

I just updated the server from linux-lts-4.4.46-1 to linux-lts-4.4.47-1, which required a reboot. I did not unmount the shares from my workstation PC during the reboot.
After the server was up again the insane smbc CPU load was back, and could as always be remedied by unmounting and re-mounting the shares on the workstation PC.

Seems like standby has less to do with it, it's just that the "reconnect-to-mounted-share-after-connection-loss" logic on the Samba client is going bonkers.

The workstation PC is running linux-4.9.7-1. I might as well run it with linux-lts just to see what happens then.
Maybe later.

Offline

#5 2017-02-09 19:18:49

deadite66
Member
Registered: 2015-06-13
Posts: 32

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

Installed autofs yesterday, maybe to early to tell but a few standbys later no more server being hammered.

Offline

#6 2017-03-16 20:40:33

valtrig
Member
From: Athens, Greece
Registered: 2017-03-16
Posts: 3

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

eomanis wrote:

Seems like standby has less to do with it, it's just that the "reconnect-to-mounted-share-after-connection-loss" logic on the Samba client is going bonkers.

Maybe you're having the same issue as me: https://bugzilla.kernel.org/show_bug.cgi?id=194531

eomanis wrote:

The workstation PC is running linux-4.9.7-1. I might as well run it with linux-lts just to see what happens then.
Maybe later.

Current LTS kernel is also 4.9 and, in my case, the issue is still there. However, it does go away with the previous LTS version, i.e. 4.4.

Offline

#7 2017-04-26 22:53:46

eomanis
Member
Registered: 2013-04-17
Posts: 50

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

valtrig wrote:

Maybe you're having the same issue as me: https://bugzilla.kernel.org/show_bug.cgi?id=194531

Nice, there already is an upstream bug report, thanks for mentioning it.

I got fed up with this and was about to write one myself for once, and had a look at this thread before doing so.
So they already have the fix in mainline since 3 days ago and they expect it to be backported to the LTS kernels at the very least, can't be long now.

Well at least I learned how to set up samba to log into the systemd journal, and how to use journalctl to look up logs. That is going to be useful.

Last edited by eomanis (2017-04-26 22:54:05)

Offline

#8 2017-05-01 21:49:16

nfm
Member
Registered: 2008-06-13
Posts: 66

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

I'm suffering from same exact issue. I see that the fix mentioned on bugzilla made its way into 4.10.13 https://git.kernel.org/pub/scm/linux/ke … s/v4.10.13

However upon updating I still have the issue, bunch of connections are still made to port 445 on my samba server and cpu load is bringing the server down to its knees and burns power/dumps heat.
Edit: fix from 4.10.13 finally took effect after rebooting both server & client PCs

Last edited by nfm (2017-05-03 22:25:06)

Offline

#9 2017-05-04 16:38:22

eomanis
Member
Registered: 2013-04-17
Posts: 50

Re: [SOLVED] Samba: Client causes high CPU load on server after standby

nfm wrote:

fix from 4.10.13 finally took effect after rebooting both server & client PCs

linux-4.10.13-1 fixed it for me, too.

Offline

Board footer

Powered by FluxBB