# smbd panic



## Crotalus (Mar 17, 2016)

I have been having an intermittent problem with net/samba43 crashing and then restarting. By rebooting the system or entering`# smbd restart` it will run fine for several weeks before crashing again. I have not been able to find the source of the problem. I first discovered the problem when a backup from a Windows machine was writing to the FreeBSD system. All of the ports are up to date at this time. I have no printers set up and I have tried several setting in /usr/local/etc/smb4.conf with no relieve.

First the environment

```
Copyright (c) 1992-2015 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
   The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.2-RELEASE-p14 #0: Wed Mar 16 20:46:12 UTC 2016
  root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: AMD Athlon(tm) 64 Processor 3500+ (2210.23-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0xf7a  Family=0xf  Model=0x7  Stepping=10  Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
  AMD Features=0xe0500800<SYSCALL,NX,MMX+,LM,3DNow!+,3DNow!>
real memory  = 4294967296 (4096 MB)
avail memory = 4074975232 (3886 MB)
```

I believe that the code below was produced when the RELEASE was p9? I have updated the system since this error.

Here is the PANIC;

```
Mar 15 09:22:21 Prometheus smbd[27114]: [2016/03/15 09:22:21.201384,  0] ../source3/lib/util.c:481(reinit_after_fork)
Mar 15 09:22:21 Prometheus smbd[27114]:  messaging_reinit() failed: NT_STATUS_ACCESS_DENIED
Mar 15 09:22:21 Prometheus smbd[27114]: [2016/03/15 09:22:21.215043,  0] ../source3/printing/print_cups.c:480(cups_pcap_load_async)
Mar 15 09:22:21 Prometheus smbd[27114]:  cups_pcap_load_async: reinit_after_fork() failed
Mar 15 09:22:21 Prometheus smbd[27114]: [2016/03/15 09:22:21.215237,  0] ../source3/lib/util.c:789(smb_panic_s3)
Mar 15 09:22:21 Prometheus smbd[27114]:  PANIC (pid 27114): cups_pcap_load_async: reinit_after_fork() failed
Mar 15 09:22:21 Prometheus smbd[27114]: [2016/03/15 09:22:21.225775,  0] ../source3/lib/util.c:900(log_stack_trace)
Mar 15 09:22:21 Prometheus smbd[27114]:  BACKTRACE: 16 stack frames:
Mar 15 09:22:21 Prometheus smbd[27114]:  #0 0x803ac8b21 <log_stack_trace+0x21> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #1 0x803ac8908 <smb_panic_s3+0x98> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #2 0x80168f4b5 <smb_panic+0x35> at /usr/local/lib/libsamba-util.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #3 0x801acd602 <cups_cache_reload+0x5a2> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:22:21 Prometheus smbd[27114]:  #4 0x801acd100 <cups_cache_reload+0xa0> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:22:21 Prometheus smbd[27114]:  #5 0x801acccac <pcap_cache_reload+0x17c> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:22:21 Prometheus smbd[27114]:  #6 0x801aaf79d <printing_subsystem_update+0x22d> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:22:21 Prometheus smbd[27114]:  #7 0x803aed35c <event_add_idle+0x54c> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #8 0x80545d145 <tevent_common_loop_timer_delay+0x165> at /usr/local/lib/libtevent.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #9 0x803aec32f <run_events_poll+0x8f> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #10 0x803aed7a4 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #11 0x805458842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #12 0x805458a7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
Mar 15 09:22:21 Prometheus smbd[27114]:  #13 0x801bb770f <smbd_process+0xe2f> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:22:21 Prometheus smbd[27114]:  #14 0x102ae30 <main+0x1e80> at /usr/local/sbin/smbd
Mar 15 09:22:21 Prometheus smbd[27114]:  #15 0x1027801 <_start+0x1a1> at /usr/local/sbin/smbd
Mar 15 09:22:21 Prometheus smbd[27114]: [2016/03/15 09:22:21.227736,  0] ../source3/lib/dumpcore.c:313(dump_core)
Mar 15 09:22:21 Prometheus smbd[27114]:  unable to change to %N.core
Mar 15 09:22:21 Prometheus smbd[27114]:  refusing to dump core
Mar 15 09:23:32 Prometheus login: ROOT LOGIN (root) ON ttyv0
Mar 15 09:23:41 Prometheus smbd[27122]: [2016/03/15 09:23:41.019466,  0] ../source3/lib/util.c:481(reinit_after_fork)
Mar 15 09:23:41 Prometheus smbd[27122]:  messaging_reinit() failed: NT_STATUS_ACCESS_DENIED
Mar 15 09:23:41 Prometheus smbd[27122]: [2016/03/15 09:23:41.020026,  0] ../source3/printing/print_cups.c:480(cups_pcap_load_async)
Mar 15 09:23:41 Prometheus smbd[27122]:  cups_pcap_load_async: reinit_after_fork() failed
Mar 15 09:23:41 Prometheus smbd[27122]: [2016/03/15 09:23:41.020059,  0] ../source3/lib/util.c:789(smb_panic_s3)
Mar 15 09:23:41 Prometheus smbd[27122]:  PANIC (pid 27122): cups_pcap_load_async: reinit_after_fork() failed
Mar 15 09:23:41 Prometheus smbd[27122]: [2016/03/15 09:23:41.022075,  0] ../source3/lib/util.c:900(log_stack_trace)
Mar 15 09:23:41 Prometheus smbd[27122]:  BACKTRACE: 16 stack frames:
Mar 15 09:23:41 Prometheus smbd[27122]:  #0 0x803ac8b21 <log_stack_trace+0x21> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #1 0x803ac8908 <smb_panic_s3+0x98> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #2 0x80168f4b5 <smb_panic+0x35> at /usr/local/lib/libsamba-util.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #3 0x801acd602 <cups_cache_reload+0x5a2> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:23:41 Prometheus smbd[27122]:  #4 0x801acd100 <cups_cache_reload+0xa0> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:23:41 Prometheus smbd[27122]:  #5 0x801acccac <pcap_cache_reload+0x17c> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:23:41 Prometheus smbd[27122]:  #6 0x801aaf79d <printing_subsystem_update+0x22d> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:23:41 Prometheus smbd[27122]:  #7 0x803aed35c <event_add_idle+0x54c> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #8 0x80545d145 <tevent_common_loop_timer_delay+0x165> at /usr/local/lib/libtevent.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #9 0x803aec32f <run_events_poll+0x8f> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #10 0x803aed7a4 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #11 0x805458842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #12 0x805458a7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
Mar 15 09:23:41 Prometheus smbd[27122]:  #13 0x801bb770f <smbd_process+0xe2f> at /usr/local/lib/samba/libsmbd-base-samba4.so
Mar 15 09:23:41 Prometheus smbd[27122]:  #14 0x102ae30 <main+0x1e80> at /usr/local/sbin/smbd
Mar 15 09:23:41 Prometheus smbd[27122]:  #15 0x1027801 <_start+0x1a1> at /usr/local/sbin/smbd
Mar 15 09:23:41 Prometheus smbd[27122]: [2016/03/15 09:23:41.022508,  0] ../source3/lib/dumpcore.c:313(dump_core)
Mar 15 09:23:41 Prometheus smbd[27122]:  unable to change to %N.core
Mar 15 09:23:41 Prometheus smbd[27122]:  refusing to dump core
Mar 15 09:23:41 Prometheus smbd[27115]: [2016/03/15 09:23:41.027357,  0] ../lib/util/pidfile.c:146(pidfile_unlink)
Mar 15 09:23:41 Prometheus smbd[27115]:  Failed to delete pidfile /var/run/samba4/smbd.pid. Error was No such file or directory
Mar 15 09:30:00 Prometheus ntpdate[27144]: ntpdate 4.2.8p6-a (1)
Mar 15 09:30:07 Prometheus ntpdate[27144]: step time server 45.79.10.228 offset -1.411578 sec
Mar 15 09:30:08 Prometheus ntpdate[27145]: ntpdate 4.2.8p6-a (1)
Mar 15 09:30:14 Prometheus ntpdate[27145]: adjust time server 128.138.141.172 offset -0.000663 sec
Mar 15 09:39:05 Prometheus su: Keith to root on /dev/pts/1
Mar 15 09:40:35 Prometheus smbd[27178]: [2016/03/15 09:40:35.690422,  0] ../lib/util/become_daemon.c:124(daemon_ready)
Mar 15 09:40:35 Prometheus smbd[27178]:  STATUS=daemon 'smbd' finished starting up and ready to serve connections
```
I have tried about every combination of the configuration of the printer section. I don't have any printers attached to the box so I don't need any set up, I let it go to the default.
Here is the net/samba43 current configuration;

```
root@Prometheus:/usr/libexec # testparm
Load smb config files from /usr/local/etc/smb4.conf
Processing section "[homes]"
Processing section "[printers]"
NOTE: Service printers is flagged unavailable.
Processing section "[public]"
Processing section "[Movies]"
Processing section "[Photos]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
  workgroup = GROUP1
  realm = GROUP1
  interfaces = 192.168.20.7
  bind interfaces only = Yes
  server role = standalone server
  map to guest = Bad User
  client max protocol = SMB2
  client min protocol = SMB2
  idmap config * : range =
  idmap config * : backend = tdb
  printing = bsd
  map readonly = no


[homes]
  comment = Home Directories
  read only = No
  browseable = No


[printers]
  comment = All Printers
  path = /var/spool/samba4
  guest ok = Yes
  printable = Yes
  browseable = No
  available = No


[public]
  comment = %h Shared Public Directory
  path = /storage2/public
  username = nobody
  force user = nobody
  force group = nobody
  group = nobody
  read only = No
  force create mode = 0666
  force directory mode = 0777
  guest ok = Yes


[Movies]
  comment = %h Shared Public Directory
  path = /storage3/Movies
  username = nobody
  force user = nobody
  force group = nobody
  group = nobody
  read only = No
  force create mode = 0666
  force directory mode = 0777
  guest ok = Yes


[Photos]
  comment = %h Shared Public Directory
  path = /storage4/Photos
  username = nobody
  force user = nobody
  force group = nobody
  group = nobody
  read only = No
  force create mode = 0666
  force directory mode = 0777
  guest ok = Yes
root@Prometheus:/usr/libexec #
```

If I don't catch the panic it will spit out 4 or 5 and then settle down for a few hours or days at the most.

If anybody has any ideas, I am open to suggestions.

Thanks!

Keith


----------



## SirDice (Mar 18, 2016)

If you don't have any printers configured why don't you remove the [printers] section completely? The panics aren't good of course but removing the section might help in your case.


----------



## Crotalus (Mar 27, 2016)

I think my problem went away after I upgraded to this;

```
samba43-4.3.3_1  Free SMB/CIFS and AD/DC server and client for Unix
```
Now I see that there is a new upgrade to be installed.

```
===>>> New version available: samba43-4.3.3_2
```
There much joy in Mudville today!


----------



## tbyte (Apr 12, 2016)

Anybody seeing this :

samba43-4.3.3_2:

```
[2016/04/11 16:47:09.529009,  0] ../source3/smbd/oplock.c:192(update_num_read_oplocks)
  PANIC: assert failed at ../source3/smbd/oplock.c(192): d->num_share_modes == 1
[2016/04/11 16:47:09.529071,  0] ../source3/lib/util.c:789(smb_panic_s3)
  PANIC (pid 4228): assert failed: d->num_share_modes == 1
[2016/04/11 16:47:09.529993,  0] ../source3/lib/util.c:900(log_stack_trace)
  BACKTRACE: 28 stack frames:
  #0 0x803abcb41 <log_stack_trace+0x21> at /usr/local/lib/libsmbconf.so.0
  #1 0x803abc928 <smb_panic_s3+0x98> at /usr/local/lib/libsmbconf.so.0
  #2 0x8016914d5 <smb_panic+0x35> at /usr/local/lib/libsamba-util.so.0
  #3 0x801c1a82e <update_num_read_oplocks+0xee> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #4 0x801b7ce30 <create_file_default+0xa800> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #5 0x801b7882c <create_file_default+0x61fc> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #6 0x801b739f1 <create_file_default+0x13c1> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #7 0x801b72bf8 <create_file_default+0x5c8> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #8 0x801d0d48c <vfs_default_init+0x149c> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #9 0x801b8f0bc <smb_vfs_call_create_file+0x22c> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #10 0x801be3178 <smbd_smb2_request_process_create+0x3218> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #11 0x801be079e <smbd_smb2_request_process_create+0x83e> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #12 0x801bce47d <smbd_smb2_request_dispatch+0x137d> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #13 0x801bd6239 <smbd_smb2_first_negprot+0x4159> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #14 0x801bd5856 <smbd_smb2_first_negprot+0x3776> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #15 0x803ae0976 <run_events_poll+0x6b6> at /usr/local/lib/libsmbconf.so.0
  #16 0x803ae17c4 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
  #17 0x805458842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
  #18 0x805458a7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
  #19 0x801badb5f <smbd_process+0xe2f> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #20 0x102d2a8 <main+0x42d8> at /usr/local/sbin/smbd
  #21 0x803ae0976 <run_events_poll+0x6b6> at /usr/local/lib/libsmbconf.so.0
  #22 0x803ae17c4 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
  #23 0x805458842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
  #24 0x805458a7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
  #25 0x102bd8f <main+0x2dbf> at /usr/local/sbin/smbd
  #26 0x102aff4 <main+0x2024> at /usr/local/sbin/smbd
  #27 0x1027821 <_start+0x1a1> at /usr/local/sbin/smbd
```
samba42-4.2.7_2:

```
[2016/04/12 02:33:39.455169,  0] ../lib/dbwrap/dbwrap.c:184(dbwrap_check_lock_order)
  Lock order violation: Trying /var/db/samba4/file_ntacls.tdb at 1 while /var/db/samba4/locking.tdb at 1 is locked
[2016/04/12 02:33:39.455433,  0] ../lib/dbwrap/dbwrap.c:133(debug_lock_order)
  lock order:  1:/var/db/samba4/locking.tdb 2:<none> 3:<none>
[2016/04/12 02:33:39.455462,  0] ../source3/lib/util.c:788(smb_panic_s3)
  PANIC (pid 6286): invalid lock_order
[2016/04/12 02:33:39.456406,  0] ../source3/lib/util.c:899(log_stack_trace)
  BACKTRACE: 32 stack frames:
  #0 0x803858921 <log_stack_trace+0x21> at /usr/local/lib/libsmbconf.so.0
  #1 0x803858708 <smb_panic_s3+0x98> at /usr/local/lib/libsmbconf.so.0
  #2 0x80169d375 <smb_panic+0x35> at /usr/local/lib/libsamba-util.so.0
  #3 0x8075fd7a8 <dbwrap_name+0x308> at /usr/local/lib/samba/libdbwrap-samba4.so
  #4 0x8075fc9a5 <dbwrap_fetch_locked+0x85> at /usr/local/lib/samba/libdbwrap-samba4.so
  #5 0x8075fc954 <dbwrap_fetch_locked+0x34> at /usr/local/lib/samba/libdbwrap-samba4.so
  #6 0x81464f082 <samba_init_module+0x1892> at /usr/local/lib/shared-modules/vfs/acl_tdb.so
  #7 0x81464eee8 <samba_init_module+0x16f8> at /usr/local/lib/shared-modules/vfs/acl_tdb.so
  #8 0x81464dc6c <samba_init_module+0x47c> at /usr/local/lib/shared-modules/vfs/acl_tdb.so
  #9 0x801b98572 <smb_vfs_call_unlink+0x52> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #10 0x801b8b38f <msg_close_file+0x113f> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #11 0x801b8a02d <close_file+0x128d> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #12 0x801b88e31 <close_file+0x91> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #13 0x801bee3d1 <smbd_smb2_request_process_close+0x12e1> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #14 0x801bed583 <smbd_smb2_request_process_close+0x493> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #15 0x801bed310 <smbd_smb2_request_process_close+0x220> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #16 0x801bd6a20 <smbd_smb2_request_dispatch+0x1330> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #17 0x801bde569 <smbd_smb2_first_negprot+0x40f9> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #18 0x801bddb86 <smbd_smb2_first_negprot+0x3716> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #19 0x80387d506 <run_events_poll+0x6b6> at /usr/local/lib/libsmbconf.so.0
  #20 0x80387e354 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
  #21 0x80525a842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
  #22 0x80525aa7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
  #23 0x801bb6366 <smbd_process+0xe26> at /usr/local/lib/samba/libsmbd-base-samba4.so
  #24 0x102fad1 <main+0x4151> at /usr/local/sbin/smbd
  #25 0x80387d506 <run_events_poll+0x6b6> at /usr/local/lib/libsmbconf.so.0
  #26 0x80387e354 <event_add_idle+0x994> at /usr/local/lib/libsmbconf.so.0
  #27 0x80525a842 <_tevent_loop_once+0x72> at /usr/local/lib/libtevent.so.0
  #28 0x80525aa7b <tevent_common_loop_wait+0x3b> at /usr/local/lib/libtevent.so.0
  #29 0x102e6ff <main+0x2d7f> at /usr/local/sbin/smbd
  #30 0x102d9f2 <main+0x2072> at /usr/local/sbin/smbd
  #31 0x1027401 <_start+0x1a1> at /usr/local/sbin/smbd
```

It's pretty much constant crashes that I have to go back to samba36-3.6.25_3 and it has no problems at all.

FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016


----------



## Crotalus (Apr 12, 2016)

Yes!

After I fixed my original panic by updating the version and removing the Printers section in /usr/local/etc/smb4.conf I started to get the same panic as you see.
I searched this document and found the answer. --->  https://www.samba.org/samba/docs/man/manpages/smb.conf.5.html#Name

Add this to your /usr/local/etc/smb4.conf in your section where you define the share.

```
oplocks = no
strict locking = no
```
I got the panic every time I accessed a share from a Windows 7 machine.  I don't know if this the best way, but it fixed my problem and I have not had any other problems to date.

I am using;

```
samba36-libsmbclient-3.6.25_2       Shared lib from the samba package
samba43-4.3.3_2                     Free SMB/CIFS and AD/DC server and client for Unix
```

Hope this helps you.


----------



## tbyte (Apr 13, 2016)

Crotalus said:


> Yes!
> 
> After I fixed my original panic by updating the version and removing the Printers section in /usr/local/etc/smb4.conf I started to get the same panic as you see.
> I searched this document and found the answer. --->  https://www.samba.org/samba/docs/man/manpages/smb.conf.5.html#Name
> ...



I will have to test that, thank you. Although I don't like the idea of skipping on this part 





> The oplock code can dramatically (approx. 30% or more) improve the speed of access to files on Samba servers.


  I mean those 30% sound too good


----------

