idle_timeout processing in the parent smbd?

James Peach jpeach at samba.org
Fri Jun 1 16:50:43 GMT 2007


On 30/05/2007, at 6:17 AM, Volker Lendecke wrote:

> Hi, James!
>
> For the clustering I need to add event loop processing to
> the parent smbd listener. This conflicts with your new
> handling of the idle_timeout variable. If the select exits
> without an active fd after the idle timeout, the parent
> exits.

It only exits if there are no clients. If there are no clients, we  
are idle and we have an idle timeout set, then exiting is the right  
thing to do.

> With timed events in, this is not right anymore.

Not sure about this. I think this depends on how you define idleness,  
see below.

> I'm going to deactivate the exit() for now, this needs to
> become a timed event.

I don't see how this can be a timed event.

The criteria for exiting is a period of idleness. You could define  
idleness to be a period without any events, but a better definition  
would be a period without any clients. If running any old event was  
enough to be "not idle", then your idle timeout would be completely  
unreliable due to the installation of timed events by parts of the  
server that aren't at all related.

Since only the launchd socket initialisation path sets the idle  
timeout, we could do something like this:

pony:~/samba/svn/branches/SAMBA_3_0/source jpeach$ svn diff smbd/ 
server.c
Index: smbd/server.c
===================================================================
--- smbd/server.c       (revision 23294)
+++ smbd/server.c       (working copy)
@@ -434,23 +434,19 @@
                         continue;
                 }
-               if (run_events(smbd_event_context(), num, &r_fds,  
&w_fds)) {
-                       continue;
-               }
-
-#if 0
-               Deactivated for now, this needs to become a timed event
-               vl
-
                 /* If the idle timeout fired and we don't have any  
connected
                  * users, exit gracefully. We should be running  
under a process
                  * controller that will restart us if necessry.
                  */
-               if (num == 0 && count_all_current_connections() == 0) {
+               if (!timeval_is_zero(&idle_timeout) && num == 0 &&
+                   count_all_current_connections() == 0) {
                         exit_server_cleanly("idle timeout");
                 }
-#endif
+               if (run_events(smbd_event_context(), num, &r_fds,  
&w_fds)) {
+                       continue;
+               }
+
                 /* check if we need to reload services */
                 check_reload(time(NULL));


--
James Peach | jpeach at samba.org




More information about the samba-technical mailing list