[Queue-developers] queued: ``sleeping'' for a while just after launch
                
                Brought to you by:
                
                    wkrebs
                    
                
            
            
        
        
        
    | 
      
      
      From: QingLong <qin...@Bo...> - 2001-02-09 15:22:28
      
     | 
| 	Hello!
   This is an excerpt from queued.c
 (``latest from sourceforge'' 1.30.1)
 in main() around lines 720--740:
|
| /*
|  * Go to sleep for a while before flooding the system with
|  * jobs, in case it crashes again right away, or the
|  * system manager wants to prevent jobs from running.
|  * Send a SIGALRM to give it a kick-start.
|  */
|
| if (!debug) {
|    alarm(sleeptime);
|
|    /* WGK: Rather than do a sigpause(), here, we do a check_query
|       here, which will cause us to wake up immediately if someone
|       submits a new job in the first few minutes. This could cause
|       the batchd to flood the system with new jobs in the event of an
|       immediate query, but is unlikely to cause any real problems.*/
|
|    check_query();
|
|    (void) alarm(0);
|  }
|
 Well, I think I understand the author intention
 and I consider the idea of having a sleep before working as reasonable.
 But there is a problem with ``immediate job submission'':
 queued fails to get new jobs during this sleeping,
 the server host closes accepted connections almost immediately
 after establishing them and client host fails to read loadaverage
 from this server host. It looks like this alarm-games confuse
 incoming connections handling code.
 I tried a dozen of times to run queued both with and without
 the above piece of code and found out that correlation with the described
 behaviour is 100%.
   So I would like to ask: is this behaviour correct?
 If not, then why not replace that code by proper select()?
   Thank you.
      Wasilx.
 |