Bug 10562 - Cleanup idle winbindd child processes.
Summary: Cleanup idle winbindd child processes.
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 4.1.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 13:43 UTC by ravindra (mail address dead)
Modified: 2014-07-26 13:21 UTC (History)
3 users (show)

See Also:


Attachments
Every 3 minutes check the size of the request queue in the child winbindd process and exit if there are none. (1.88 KB, patch)
2014-04-24 13:43 UTC, ravindra (mail address dead)
no flags Details
Cleanup handler is installed in the arent winbindd. Handler checks if the child is free and if so forces it to exit. (2.88 KB, patch)
2014-04-25 15:50 UTC, ravindra (mail address dead)
no flags Details
Winbindd proces is cleaned only if it remains idle for more than 1 min. Added a smb.conf paramter to control the triggering of the cleanup handler. (7.03 KB, patch)
2014-05-05 12:44 UTC, ravindra (mail address dead)
no flags Details
Corrected wrong parameter initalizing in loadparm.c (7.04 KB, patch)
2014-05-07 11:23 UTC, ravindra (mail address dead)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ravindra (mail address dead) 2014-04-24 13:43:03 UTC
Created attachment 9868 [details]
Every 3 minutes check the size of the request queue in the child winbindd process and exit if there are none.

With 'winbind max domain connecitons' setting, we can have as many child winbindd processes as the value configured.  Also, depending on the number of trusted domains the number of winbindd processes increase.

These processes once started during the load do not exit when there is no login activity.

This may create unnecessary system load. It would be good to make the child winbindd processes exit if there are no pending requests for it.

This attahced patch (git diff) intends to do the same. Please check.
Comment 1 Volker Lendecke 2014-04-24 14:52:32 UTC
See my comment in https://lists.samba.org/archive/samba-technical/2014-April/099277.html
Comment 2 ravindra (mail address dead) 2014-04-25 15:50:58 UTC
Created attachment 9875 [details]
Cleanup handler is installed in the arent winbindd. Handler checks if the child is free and if so forces it to exit.
Comment 3 ravindra (mail address dead) 2014-04-25 15:56:02 UTC
Thanks Volker. Yes, the first patch (attachment 9868 [details]) does not work as I expected.

I have re worked the patch and attaching a new patch (attachment 9875 [details]). Now cleanup handler is installed in the parent winbindd (winbindd.c). The handler iterates through all domains, all the child processes for each domain, checks if the child queue is empty, then if empty send SIGTERM signal to child.

Please check.
Comment 4 ravindra (mail address dead) 2014-05-05 12:44:33 UTC
Created attachment 9899 [details]
Winbindd proces is cleaned only if it remains idle for more than 1 min. Added a smb.conf paramter to control the triggering of the cleanup handler.


Attaching an improved patch. Now, cleanup handler waits for an idle winbindd process to remain idle for 1 min. 
I also thought it would be better to add a smb.conf parameter to control the triggering of this cleanup handler. The new parameter is "winbind idle child cleanup interval". If this parameter is set to '0' (default value) then the cleanup handler is not triggered.
Comment 5 ravindra (mail address dead) 2014-05-06 17:58:11 UTC
Any more suggestions on latest patch  [attachment 9899 [details]]. If not can we take this patch?
Comment 6 Volker Lendecke 2014-05-06 20:15:53 UTC
If this patch works for you, you're certainly free to use it. Unfortunately I am pretty busy right now, so I had no time yet to go through it thorougly. Might take a few more days, it's in my inbox.
Comment 7 ravindra (mail address dead) 2014-05-07 11:19:35 UTC
Volker,

Actually there is mistake in my previous patch. Apologies for that.

Below file change 
********
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -861,6 +861,7 @@ static void init_globals(bool reinit_globals)
 	Globals.log_writeable_files_on_exit = false;
 	Globals.create_krb5_conf = true;
 	Globals.winbindMaxDomainConnections = 1;
+	Globals.machine_password_timeout = 0;

*******

should be 

*************
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -861,6 +861,7 @@ static void init_globals(bool reinit_globals)
 	Globals.log_writeable_files_on_exit = false;
 	Globals.create_krb5_conf = true;
 	Globals.winbindMaxDomainConnections = 1;
+	Globals.winbind_idle_child_cleanup_interval = 0;
 
*************

will attach corrected patch. Please bear with my little experience with git Samba as well.

Meantime we will be testing the patch in our test bed.

Thanks,
Comment 8 ravindra (mail address dead) 2014-05-07 11:23:28 UTC
Created attachment 9919 [details]
Corrected wrong parameter initalizing in loadparm.c
Comment 9 Björn Jacke 2014-07-26 13:21:27 UTC
have a look at bug #3204