Bug 1117 - Reloading smb.conf hangs server if many smbd processes are running.
Summary: Reloading smb.conf hangs server if many smbd processes are running.
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Config Files (show other bugs)
Version: 3.0.2
Hardware: All Linux
: P3 critical
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
Depends on:
Reported: 2004-02-23 02:56 UTC by Tim Verhoeven
Modified: 2005-10-19 04:58 UTC (History)
1 user (show)

See Also:

Spread the re-load of smb.conf (828 bytes, patch)
2005-10-18 04:21 UTC, Volker Lendecke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Verhoeven 2004-02-23 02:56:40 UTC
Running Samba 3.0.2 on Redhat 7.3 on a IBM xSeries 345 (2.8 GHz, 1GB Ram) with
1Gb connection to the LAN.

Currently we are serving about 700 different shares on this machine, so we have
a big smb.conf. But we are running into a scalability issue. If we do a reload
of the smb.conf (either through smbcontrol or just by editing it) we can see all
smbd processes using a lot of CPU. It seems that each smbd process does its own
parsing of the smb.conf file.

If we have enough connections open (meaning a lot of smbd processes) this
becomes that bad that all the smbd processes hang the server. In our case
starting at 500 smbd processes will do this. We then have to wait for 15 minutes
or more for everything to start running normally again.

Two possible ways to fix this.
- Have the root smbd process to the smb.conf parsing and then distribute the
parsed data to child processes.
- Allow the smb.conf change check interval to be a option in smb.conf so that we
can increase the interval to spread the load. This only works if each smbd
process has it's own counter.
Comment 1 Anthony Liguori 2004-02-23 12:40:08 UTC
Initial profile shows over half a million calls to strwicmp.  This is mostly due
to checks in add_a_service via getservicebyname and by map_parameter.  Been able
to (in testing) reduce to only ~37k calls but have not confirmed this as the
source of the hang (although it seems likely).
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-02-22 06:40:36 UTC
lowering priority based on resources.
Comment 3 Roman Berjoza 2005-05-06 06:15:41 UTC
I confirm this bug in samba-3.0.13
Comment 4 Gerald (Jerry) Carter (dead mail address) 2005-09-29 07:36:00 UTC
Known issue. I have plans for this possibly in 3.0.22.  
But it's a major rework of the smb.conf and parameter 
Comment 5 Volker Lendecke 2005-10-18 04:21:01 UTC
Created attachment 1523 [details]
Spread the re-load of smb.conf

Jerry, what about something along the lines of the attached (untested) patch
until we have streamlined loadparm.c?

Comment 6 Gerald (Jerry) Carter (dead mail address) 2005-10-19 04:58:23 UTC
Volker, the patch is propbably ok.  But I would prefer to have 
some testing as proof that it does help alleviate the load.