smbstatus reports dead connection as active

Bug #1392647 reported by latimerio
38
This bug affects 7 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Undecided
Unassigned

Bug Description

I have a home server running ubuntu 14.04.1 LTS.
It was setup originally with ubuntu 12.04 LTS and running satisfactorily for more than 2 years
The server checks every 10 minutes and goes to sleep if no active clients are detected.
My main PC is a w7 box connecting to some samba shares on the server.
In the past 3 weeks it happened 3 times that the server reported an active samba connection although the client had long been shutdown.
At the first occurrence I set the deadtime parameter to 10 but this did not solve the problem.
The deadtime parameter was not there at all for the past 2 years and the problem only showed up lately so I think the cause of problem is somewhere else.

This is the output of smbstatus -v taken about 2 hours after the client has been powered off.
It should not show the 4366 PID lines.

Samba version 4.1.6-Ubuntu
PID Username Group Machine
-------------------------------------------------------------------
4366 father father 192.168.101.69 (ipv4:192.168.101.69:2132)
Opened /var/run/samba/connections.tdb

Service pid machine Connected at
-------------------------------------------------------
HomeServer 4366 192.168.101.69 Thu Nov 13 19:03:04 2014

Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
4366 1000 DENY_NONE 0x100081 RDONLY NONE /Data.Home . Thu Nov 13 19:03:04 2014

apt-cache policy samba reports
samba:
  Installed: 2:4.1.6+dfsg-1ubuntu2.14.04.3
  Candidate: 2:4.1.6+dfsg-1ubuntu2.14.04.3
  Version table:
 *** 2:4.1.6+dfsg-1ubuntu2.14.04.3 0
        500 http://de.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2:4.1.6+dfsg-1ubuntu2 0
        500 http://de.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

My list of installed packages is attached.

Revision history for this message
latimerio (fomember) wrote :
Revision history for this message
pierrot (bo-hempel) wrote :

I'm having the exact same problem. First time I was experiencing this issue was about a year ago when I was setting up a new Server based on Ubuntu 14.04. I was not sure whether it was a bug in Samba or a problem womewhere else. My Solution at that time was going back to 12.04 with Samba 3.6.3 which stills works fine.

Now, for different reasons I thought about upgrading to 14.04 and was hoping to find this bug gone. It's a shame that it's still existing.
I also tried setting up Samba on a Debian server and even compiled the newest Samba version 4.3.1 with no remedy.

I assume it is maybe not a problem based in Ubuntu or Debian but only within the Samba sources.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Revision history for this message
pierrot (bo-hempel) wrote :

Here is some additional information that I could gather over this problem:

- smbstatus from samba 4.3.1 also shows the Protocol version from connected clients:

root@vdebian:~# smbstatus -v
using configfile = /usr/local/samba/etc/smb.conf

Samba version 4.3.1
PID Username Group Machine Protocol Version
------------------------------------------------------------------------------
733 client1 clients 192.168.1.21 (ipv4:192.168.1.21:57591) Unknown (0x0311)
Opened /usr/local/samba/var/lock/connections.tdb
...

Unless I force Win10 to use SMBv1 it talks to samba with SMBv3 and in this case smbstatus reports "Unknown (0x0311)". Otherwise (with SMBv1, an XP- or Linux-client) it shows a correct Version like "NT1".
Also see https://bugzilla.samba.org/show_bug.cgi?id=11472

- When using the -v option with smbstatus, it prints the line "Opened /usr/local/samba/var/lock/connections.tdb". When I browse this directory and look for connections.tdb, the file simply does not exist.

- The problems as shown above only occur when a Windows-client connects via SMBv2/3 (e.g. Win7/8/10) to Samba 4.1.x (maybe also 4.0.x, I haven't testet yet).

So in my layman's terms I would explain it like this: on the one hand it's the clients fault when it doesn't tell to the server to release locked files. Maybe SMBv2/3 uses some faulty functionality that is completely ignored by Samba 3.x and therefore causes no issue - other than Samba 4.x. On the other hand the server should be able to detect dead connections and close them after a while since there is a chance that the client lost the connection unexpectedly or because of external reasons.

Revision history for this message
Roland Steinbach (webstoney) wrote :

Also affects 16.04.x

Revision history for this message
luca (alunno) wrote :

This issue with Windows 10 client is very annoiyng because will let samba service down.
There is a patch expected soon?
On my own, i have to downgrade to NT1 protocol on some production machines, not really good at all

Revision history for this message
Konstantin Hollerith (hinnelinks) wrote :

I'm also using smbstatus to power of my server, if it's not in use, but this bug prevents it.

I created this workaround script to ping the ip's (only ipv4) that smbstatus reports, it reports the ip's as "online" or "offline". One could also alter the script so the output is exactly like "smbstatus -b", just showing the online clients only.

#!/bin/bash
# returns 1 if any smb client is online, otherwise 0
function pingClient
{
    ping -c1 -W1 -q $1 &>/dev/null
    status=$( echo $? )
    if [[ $status == 0 ]] ; then
         #ping success
        echo "smb client $1 online"
        return 1
    else
         #ping failure
        echo "smb client $1 offline"
    fi
}
sudo /usr/bin/smbstatus -b | grep -o -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | sort | uniq | while read -r a; do pingClient $a; done

Revision history for this message
luca (alunno) wrote :

This Issue affect Samba 4.3.11 Ubuntu 14.04 and 16.04 .
Does not affect Samba 4.6.2 On Centos 7..
It would be very apprecied that Ubuntu support Team fix this REALLY annoying bug as soon as possible.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.