[mod_python] strange behavior with mpm worker (inaccurate number of max processes?)

Graham Dumpleton graham.dumpleton at gmail.com
Mon Jan 21 22:37:34 EST 2008


Just ignore it if it seems wrong. It is quite possible mod_python does
it wrong, or does it in a way which isn't compatible with newer
versions of Apache. The code certainly has various warnings against
the code which make it look a little suspect.

    /* figure out maximum possible concurrent connections */
    /* MAX_DAEMON_USED seems to account for MaxClients, as opposed to
       MAX_DAEMONS, which is ServerLimit
    */
    ap_mpm_query(AP_MPMQ_IS_THREADED, &is_threaded);
    if (is_threaded != AP_MPMQ_NOT_SUPPORTED) {
        ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads);
    }
    ap_mpm_query(AP_MPMQ_IS_FORKED, &is_forked);
    if (is_forked != AP_MPMQ_NOT_SUPPORTED) {
        /* XXX This looks strange, and it is. prefork.c seems to use
           MAX_DAEMON_USED the same way that worker.c uses
           MAX_DAEMONS (prefork is wrong IMO) */
        ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_procs);
        if (max_procs == -1) {
            ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_procs);
        }
    }
    max_clients = (((max_threads <= 0) ? 1 : max_threads) *
                   ((max_procs <= 0) ? 1 : max_procs));

Graham

On 21/01/2008, Alec Matusis <matusis at yahoo.com> wrote:
>
>
>
>
> We are using worker MPM
>
> Our apache configuration is
>
>
>
> ServerLimit 40
>
> ThreadLimit 70
>
>
>
> StartServers          10
>
> MaxClients            1600
>
> MinSpareThreads       75
>
> MaxSpareThreads       200
>
> ThreadsPerChild       40
>
> MaxRequestsPerChild   10000
>
>
>
> When apache is restarted with
>
> #apachectl stop
>
> #apachectl start
>
> We get in the error log:
>
> [notice] mod_python: Creating 32 session mutexes based on 40 max processes
> and 40 max threads
>
> [notice] Apache/2.2.6 (Unix) mod_python/3.3.1 Python/2.4.1 configured --
> resuming normal operations
>
> This is what we expect.
>
>
>
> Now we restart apache this way:
>
> #apachectl restart
>
> In the error log:
>
> [notice] SIGHUP received.  Attempting to restart
>
>  [notice] mod_python: Creating 32 session mutexes based on 11 max processes
> and 40 max threads.
>
>  [notice] mod_python: using mutex_directory /tmp
>
>  [notice] Apache/2.2.6 (Unix) mod_python/3.3.1 Python/2.4.1 configured --
> resuming normal operations
>
>
>
> Where does this number "11 max processes" come from? We do not have it
> anywhere in the configuration.
>
>
>
>
>
> We get
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list