[Samba] Mac Clients Disconnect with: source3/smbd/service.c:1050(close_cnum) closed connection to service data

Louis Waweru law2175 at columbia.edu
Fri Oct 18 11:35:16 UTC 2019


I have an issue where Macs running a wide range of OS versions all drop
connections at seemingly random intervals, but usually after some long
period of time less than 24 hours. The Windows clients keep their
connections, however.

I can test this in PowerShell with a loop like the following:
PS C:\Users\louis> while($true) { Add-Content
Z:\_smbcheck\windwows-client.txt $DT; Start-Sleep 10;  $DT = Get-Date; }

This will run endlessly.

Similar tests on different Mac clients, all connected to Ethernet on
reliable network infrastructure will all fail within hours, and at
different times:
while sleep 10; do echo "Alive at: `date`" >>
/Volumes/data/_smbcheck/macClientServerSigningOff; done

while sleep 10; do echo "Alive at: `date`" >>
/Volumes/data/_smbcheck/macClientServerSigningOn; done

while sleep 10; do echo "Alive at: `date`" >>
/Volumes/data/_smbcheck/macClientServerSMB2; done

while sleep 10; do echo "Alive at: `date`" >>
/Volumes/data/_smbcheck/macClientServerSMB3-Caffeinate; done


The Mac computers running these loops range from completely vanilla to
having suggested tweaks found here and there.

In the logs, the only indication of these events are the following:

[2019/10/18 05:27:37.005650,  2] ../source3/smbd/service.c:1050(close_cnum) (ipv4: closed connection to service data

The Mac clients don't all do this at the same time. It happens completely
irregularly and not at fixed intervals.

I've tried all the various possibilities in a Mac client's /etc/nsmb.conf
to no avail:




I've set the most power aggressive energy settings, and even used caffeinate
<https://github.com/newmarcel/KeepingYouAwake> to make sure the computer
was always awake.

I've tested a brand new NIC on the server, upgrading firmware on the
server, building new versions of samba, reinstalling to Ubuntu 16.04 from
18.04 and upgrading to 18.10 and 19.04 hoping to find a version that didn't
have the issue.

How can I begin to diagnose this issue, assuming hardware is fine.

In summary all hardware tests pass, and after testing with a new NIC, and
the fact that Windows clients don't disconnect make me feel like it's a Mac
issue, and there are countless threads on the Internet complaining about
how Apple implemented SMB, but I'm hoping to learn what these log messages

[TimeStamp,  2] ../source3/smbd/service.c:1050(close_cnum) (ipv4: closed connection to service data

Are they initiated on the client or server side?

I am digging for a configuration fix, because there are actually a dozen
other servers set up with the same provisioning protocol that don't have
the issue.

Example: smb.conf file:


workgroup = DEPT

security = ads


;idmap backend = tdb

;idmap uid = 20000-299999

;idmap gid = 20000-299999

idmap config DEPT:backend = rid

idmap config DEPT:range = 10000-199999

winbind enum users = yes

winbind enum groups = yes

winbind use default domain = yes

winbind nested groups = yes

winbind refresh tickets = yes

winbind offline logon = true

winbind expand groups = 1

template homedir = /home/%U

template shell = /bin/bash

client use spnego = yes

client ntlmv2 auth = yes

log file = /var/log/samba/samba.log

log level = 2

;obey pam restrictions = yes

min protocol = SMB2

client min protocol = SMB2

inherit permissions = yes

client ipc signing = auto

;wins support = yes


available = yes

comment = Home directories

read only = No

browseable = No


available = yes

comment = Main data store for all users

path = /data

valid users = +DEPT\groupxusers

force group = +DEPT\groupxusers

writable = yes

read only = no

Comments in the above show things I have tried enabling and disabling.

Higher log levels don't indicate anything before, between, or after:

../source3/smbd/service.c:1050(close_cnum) (ipv4: closed connection to service data

Many thanks,

Louis Waweru
Senior Staff Associate
Department of Psychology
373 Schermerhorn Ext.
Columbia University
(212) 854-8167
(347) 843-9167

More information about the samba mailing list