Problems with samba and vista on 7.1-STABLE

Goran Lowkrantz goran.lowkrantz at ismobile.com
Sat Feb 14 13:54:09 PST 2009


I have few Samba servers running FreeBSD 7.1 were we have a problem with 
connection blocking from a few Vista systems that run programs that watch 
directories and files on the samba shares.

On my test setup I have managed to get a hang in about 30 min.

Samba is built with minimum functions and full debug. Options don't seems 
to have any impact on the problem.

The PC uses Vista Business SP1 and all patches, I run a DAM program called 
IMatch that watches for changes in the photo database.

The FreeBSD server is an up-to-date quad AMD server with 8GB running 
7.1-STABLE. In normal operation, I see the following:

# sockstat | grep 445
glz      smbd       7828  23 tcp4   10.255.253.1:445      10.255.253.2:57355
root     smbd       76917 19 tcp4   127.0.0.1:445         *:*
root     smbd       76917 20 tcp4   10.255.253.1:445      *:*

When I get the hang, it looks like this:
# sockstat | grep 445
root     smbd       7828  23 tcp4   10.255.253.1:445      10.255.253.2:57355
root     smbd       76917 19 tcp4   127.0.0.1:445         *:*
root     smbd       76917 20 tcp4   10.255.253.1:445      *:*

and the GDB session:
# gdb /usr/local/sbin/smbd 7828
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Attaching to program: /usr/local/sbin/smbd, process 7828
Reading symbols from /usr/local/lib/libldap-2.3.so.2...done.
Loaded symbols for /usr/local/lib/libldap-2.3.so.2
Reading symbols from /usr/local/lib/liblber-2.3.so.2...done.
Loaded symbols for /usr/local/lib/liblber-2.3.so.2
Reading symbols from /usr/local/lib/libcups.so.2...done.
Loaded symbols for /usr/local/lib/libcups.so.2
Reading symbols from /usr/lib/libssl.so.5...done.
Loaded symbols for /usr/lib/libssl.so.5
Reading symbols from /lib/libcrypto.so.5...done.
Loaded symbols for /lib/libcrypto.so.5
Reading symbols from /lib/libz.so.4...done.
Loaded symbols for /lib/libz.so.4
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libcrypt.so.4...done.
Loaded symbols for /lib/libcrypt.so.4
Reading symbols from /usr/lib/libpam.so.4...done.
Loaded symbols for /usr/lib/libpam.so.4
Reading symbols from /usr/local/lib/libexecinfo.so.1...done.
Loaded symbols for /usr/local/lib/libexecinfo.so.1
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /usr/local/lib/libdmalloc.so.1...done.
Loaded symbols for /usr/local/lib/libdmalloc.so.1
Reading symbols from /usr/local/lib/libpopt.so.0...done.
Loaded symbols for /usr/local/lib/libpopt.so.0
Reading symbols from /lib/libthr.so.3...done.
[New Thread 0x800a62e00 (LWP 100076)]
Loaded symbols for /lib/libthr.so.3
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/libsasl2.so.2...done.
Loaded symbols for /usr/local/lib/libsasl2.so.2
Reading symbols from /usr/local/lib/libintl.so.8...done.
Loaded symbols for /usr/local/lib/libintl.so.8
Reading symbols from /usr/local/lib/nss_ldap.so.1...done.
Loaded symbols for /usr/local/lib/nss_ldap.so.1
Reading symbols from /usr/lib/libcom_err.so.4...done.
Loaded symbols for /usr/lib/libcom_err.so.4
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
[Switching to Thread 0x800a62e00 (LWP 100076)]
0x0000000801f01d6c in select () from /lib/libc.so.7
(gdb) directory /usr/ports/net/samba32-devel/work/samba-3.2.7/source/
Source directories searched: 
/usr/ports/net/samba32-devel/work/samba-3.2.7/source:$cdir:$cwd
(gdb) bt
#0  0x0000000801f01d6c in select () from /lib/libc.so.7
#1  0x0000000801d0f4d4 in select () from /lib/libthr.so.3
#2  0x00000000006749fe in sys_select (maxfd=24, readfds=0x7fffffffd420, 
writefds=0x7fffffffd3a0, errorfds=0x0, tval=0x7fffffffd500)
    at lib/select.c:93
#3  0x00000000004df64c in smbd_process () at smbd/process.c:839
#4  0x0000000000854074 in main (argc=2, argv=0x7fffffffd638) at 
smbd/server.c:1450
(gdb) frame 2
#2  0x00000000006749fe in sys_select (maxfd=24, readfds=0x7fffffffd420, 
writefds=0x7fffffffd3a0, errorfds=0x0, tval=0x7fffffffd500)
    at lib/select.c:93
93              ret = select(maxfd,readfds2,writefds,errorfds,tval);
(gdb) print tval
$1 = (struct timeval *) 0x7fffffffd500
(gdb) print *tval
$2 = {tv_sec = 59, tv_usec = 999977}
(gdb) The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /usr/local/sbin/smbd, process 7828

The following is a truss of the process until I have seen the switch to 
root as owner:
# time truss -p 8307
gettimeofday({1234648077.989004 },0x0)           = 0 (0x0)
gettimeofday({1234648077.989081 },0x0)           = 0 (0x0)
select(24,{6 23},{},0x0,{21.288167 })            = 0 (0x0)
gettimeofday({1234648099.279293 },0x0)           = 0 (0x0)
gettimeofday({1234648099.279370 },0x0)           = 0 (0x0)
gettimeofday({1234648099.279417 },0x0)           = 0 (0x0)
select(24,{6 23},{},0x0,{59.989982 })            = 1 (0x1)
gettimeofday({1234648102.286493 },0x0)           = 0 (0x0)
read(23,"\0\0\0r",4)                             = 4 (0x4)
read(23,"\M^?SMB2\0\0\0\0\^X\a\M-H\0\0\0"...,114) = 114 (0x72)
geteuid(0x3e8,0x3e8,0x2,0x800adf750,0x2,0x800adf750) = 0 (0x0)
getegid(0x3e8,0x3e8,0x2,0x801eadb8c,0xffffff006cf16a50,0x7fffffffd138) = 0 
(0x0)
__sysctl(0x7fffffffd0a0,0x2,0x7fffffffd0bc,0x7fffffffd0b0,0x0,0x0) = 0 (0x0)
0.000u 0.001s 2:36.56 0.0%    0+0k 0+0io 0pf+0w

# sockstat | grep 445
glz      smbd       8307  23 tcp4   10.255.253.1:445      10.255.253.2:57438
root     smbd       76917 19 tcp4   127.0.0.1:445         *:*
root     smbd       76917 20 tcp4   10.255.253.1:445      *:*
# ps -awxl | grep 8307
 1000  8307  8556   0  44  0 34672  7984 select IX    ??    0:04.57 
/usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    0  8556  3273   0   8  0  4600  1204 wait   I+    p0    0:00.00 truss 
-p 8307
# sockstat | grep 445
root     smbd       8307  23 tcp4   10.255.253.1:445      10.255.253.2:57438
root     smbd       76917 19 tcp4   127.0.0.1:445         *:*
root     smbd       76917 20 tcp4   10.255.253.1:445      *:*
# ps -awxl | grep 8307
    0  8307  8556   0  44  0 34672  7984 select SX    ??    0:04.57 
/usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    0  8556  3273   0   8  0  4600  1204 wait   I+    p0    0:00.00 truss 
-p 8307


I can recreate this at any time and the condition can be cleared in two 
ways:
- killing the offending smbd process and the PC reconnects just fine
- attach and detach truss, as can bee seen in the logs below taken after 
the truss session above:
# sockstat | grep 445
glz      smbd       8307  23 tcp4   10.255.253.1:445      10.255.253.2:57438
root     smbd       76917 19 tcp4   127.0.0.1:445         *:*
root     smbd       76917 20 tcp4   10.255.253.1:445      *:*
# ps -awxl | grep 8307
 1000  8307 76917   0  44  0 34672  7984 select S     ??    0:04.58 
/usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf

/glz

................................................... the future isMobile

  Goran Lowkrantz <goran.lowkrantz at ismobile.com>
  System Architect, isMobile, Aurorum 2, S-977 75 Luleå, Sweden
  Phone: +46(0)920-75559
  Mobile: +46(0)70-587 87 82 Fax: +46(0)70-615 87 82

http://www.ismobile.com ...............................................


More information about the freebsd-stable mailing list