[Samba] smb keeps stale connections from logged out users and shut down clients

Vlastimil Šetka setka at spsostrov.cz
Mon Feb 9 15:09:51 GMT 2009

Volker Lendecke wrote:
> On Mon, Feb 09, 2009 at 03:17:27PM +0100, Frederik wrote:
>> We are using Samba 3.0.33 as a PDC and file server for Windows XP
>> clients, but seem to be suffering lots of stale connections. smbstatus
>> still shows connections from users already logged out and even from
>> systems which have already been shut down.
>> Restarting the samba service, cleans up all stale connections.
>> We tried deadtime = 5 in the samba configuration file, but this does
>> not help at all.
> The parameter "keepalive" doesn't help either?
> Volker
We have similar problems with Samba 3.0.24 (Debian Etch) as PDC for ~120 
Win XP clients.

See also this thread refering about our problems:

Since that time I made some investigations with interesting results.

About once per month it's a locking issue and the smbd proccess exists. 
It is
not a big problem. After Samba restart all is OK.

But other problem come up when logging smbstatus output every 10 seconds 
for audit purpose.
Wery often smbstatus shows a connected user from computer which have 
already been shut down
or from computer where other user is loged in (see referred thread).
This connections is showed usually for ~30 seconds and then disappear. I 
modified my logging
script: it also logs the proccess name of each PID in smbstatus. I found 
that PIDs of the
"ghost" connections is not the smbd! It's cron tasks, apache cgi scrips, 
... !

I patched smbstatus: normally it loads the sessionid.tdb database and 
checks if PID of
proccess in database exists. In my modification it also shows records 
with PIDs that
do not exist.

After a day after the Samba restart and ~400 domain logon/logoff there 
is about ~15
records with bad PID in the sessionid.tdb - with normal smbstatus this 
records are not
showed - only if the process with the PID coincidentally exists...

I think that Samba should have some self-healing mechanisms with 
sessionid.tdb. I can imagine
some garbage collector periodically checking existence of PIDs for all 
records in sessionid.tdb
and if such PID does not exists it should delete the record.
Have Samba such feature in newer versions, or is it other error?


Vlastimil Setka

More information about the samba mailing list