View | Details | Raw Unified | Return to bug 42216
Collapse All | Expand All

(-)server/mpm/prefork/prefork.c.orig (-1 / +39 lines)
Lines 102-107 Link Here
102
static int mpm_state = AP_MPMQ_STARTING;
102
static int mpm_state = AP_MPMQ_STARTING;
103
static ap_pod_t *pod;
103
static ap_pod_t *pod;
104
104
105
#define MAX_OVLP_LINE 64
106
static int reported = 0;
107
static char overload_procedure[MAX_OVLP_LINE];
108
105
/*
109
/*
106
 * The max child slot ever assigned, preserved across restarts.  Necessary
110
 * The max child slot ever assigned, preserved across restarts.  Necessary
107
 * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We
111
 * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We
Lines 839-851 Link Here
839
        /* terminate the free list */
843
        /* terminate the free list */
840
        if (free_length == 0) {
844
        if (free_length == 0) {
841
            /* only report this condition once */
845
            /* only report this condition once */
842
            static int reported = 0;
843
846
844
            if (!reported) {
847
            if (!reported) {
845
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf,
848
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf,
846
                            "server reached MaxClients setting, consider"
849
                            "server reached MaxClients setting, consider"
847
                            " raising the MaxClients setting");
850
                            " raising the MaxClients setting");
848
                reported = 1;
851
                reported = 1;
852
                if (strlen(overload_procedure)) {
853
                    if(!fork()) {
854
                        system(overload_procedure);
855
                        ap_log_error(APLOG_MARK, APLOG_INFO, 0,
856
                                     ap_server_conf,
857
                                     "external OverLoad Procedure %s launched",
858
                                     overload_procedure);
859
                        exit(1);
860
                    }
861
                }
849
            }
862
            }
850
            idle_spawn_rate = 1;
863
            idle_spawn_rate = 1;
851
        }
864
        }
Lines 884-889 Link Here
884
    }
897
    }
885
    else {
898
    else {
886
        idle_spawn_rate = 1;
899
        idle_spawn_rate = 1;
900
        if (reported) {
901
            ap_log_error(APLOG_MARK, APLOG_INFO, 0,
902
            ap_server_conf,
903
            "back to normal load state");
904
        }
905
        reported = 0;
887
    }
906
    }
888
}
907
}
889
908
Lines 1449-1454 Link Here
1449
    return NULL;
1468
    return NULL;
1450
}
1469
}
1451
1470
1471
static const char *set_overload_procedure(cmd_parms *cmd, void *dummy,
1472
                                         const char *arg)
1473
{
1474
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
1475
    if (err != NULL) {
1476
        return err;
1477
    }
1478
    if (strlen(arg) > MAX_OVLP_LINE-1) {
1479
        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
1480
                     "WARNING: OverLoadProcedure Definition Line too long -> OverLoadProcedure not set");
1481
        return err;
1482
    }
1483
1484
    strcpy(overload_procedure,arg);
1485
    return NULL;
1486
}
1487
1452
static const command_rec prefork_cmds[] = {
1488
static const command_rec prefork_cmds[] = {
1453
UNIX_DAEMON_COMMANDS,
1489
UNIX_DAEMON_COMMANDS,
1454
LISTEN_COMMANDS,
1490
LISTEN_COMMANDS,
Lines 1462-1467 Link Here
1462
              "Maximum number of children alive at the same time"),
1498
              "Maximum number of children alive at the same time"),
1463
AP_INIT_TAKE1("ServerLimit", set_server_limit, NULL, RSRC_CONF,
1499
AP_INIT_TAKE1("ServerLimit", set_server_limit, NULL, RSRC_CONF,
1464
              "Maximum value of MaxClients for this run of Apache"),
1500
              "Maximum value of MaxClients for this run of Apache"),
1501
AP_INIT_TAKE1("OverLoadProcedure", set_overload_procedure, NULL, RSRC_CONF,
1502
              "External Program -- Runs after a OverLoad Detection"),
1465
AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
1503
AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
1466
{ NULL }
1504
{ NULL }
1467
};
1505
};

Return to bug 42216