imapd's hang when maxchild count is reached

Jure Pecar pegasus at nerv.eu.org
Wed Feb 5 16:02:30 EST 2003


On Wed, 05 Feb 2003 15:21:26 -0500
Scott Adkins <adkinss at ohio.edu> wrote:

> I solved this problem a long time ago by passing an environment variable
> from the master process to the child process when the child process is
> spawned indicating that the server is full.  I used CYRUS_MAXCHILD, and
> the child process already checks for the CYRUS_VERBOSE variable when it
> starts in order to properly set the debugging level.  If that variable
> was set, then the child would output an error message indicating that the
> server was full and to try again later.  It would then close the client
> connection and then exit.
> 
> A couple things to note:
> 
>   1) I prefer the client to be notified when the server is full and not
>      simply get connection refused messages or have the email client just
>      sit there, appearing to hang, while the server waits for a connection
>      to become free.
> 
>   2) My method worked, but it didn't take advantage of the process reuse
>      feature.  Basically, the master process only gets one chance to pass
>      an environment variable off to the child process.  So, once that
>      variable is set in the child, the child will always believe that the
>      max has been reached.  That is why I had the child process go away,
>      as it is basically useless after handling that one connection.
> 
>   3) If there was a good way for the master to notify the child process
>      on each connection pass (either when passing the connection to an
>      already available child, or when passing the connectioin to a newly
>      spawn child) what the current status of maxchild is, then it would
>      be quite efficient to send the server full messages, close the
>      connection and wait for the master process to hand it another.  I
>      don't know enough about how the master and child process communicate
>      to know how to make this work.
> 
> Scott


Now that you're discussing the mechanisms to refuse new connections politely
because of some condition, i would like to suggest another condition to
check: system loadavg. Some programs (sendmail for example) know how to
reject connections if loadavg is >= some admin defined value. 

-- 

Jure Pecar




More information about the Info-cyrus mailing list