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

(-)server/mpm/worker/worker.c.orig (-1 / +39 lines)
Lines 136-141 Link Here
136
static int mpm_state = AP_MPMQ_STARTING;
136
static int mpm_state = AP_MPMQ_STARTING;
137
static int sick_child_detected;
137
static int sick_child_detected;
138
138
139
#define MAX_OVLP_LINE 64
140
static int reported = 0;
141
static char overload_procedure[MAX_OVLP_LINE];
142
139
/* The structure used to pass unique initialization info to each thread */
143
/* The structure used to pass unique initialization info to each thread */
140
typedef struct {
144
typedef struct {
141
    int pid;
145
    int pid;
Lines 1514-1520 Link Here
1514
        /* terminate the free list */
1518
        /* terminate the free list */
1515
        if (free_length == 0) {
1519
        if (free_length == 0) {
1516
            /* only report this condition once */
1520
            /* only report this condition once */
1517
            static int reported = 0;
1518
1521
1519
            if (!reported) {
1522
            if (!reported) {
1520
                ap_log_error(APLOG_MARK, APLOG_ERR, 0,
1523
                ap_log_error(APLOG_MARK, APLOG_ERR, 0,
Lines 1522-1527 Link Here
1522
                             "server reached MaxClients setting, consider"
1525
                             "server reached MaxClients setting, consider"
1523
                             " raising the MaxClients setting");
1526
                             " raising the MaxClients setting");
1524
                reported = 1;
1527
                reported = 1;
1528
                if (strlen(overload_procedure)) {
1529
                    if(!fork()) {
1530
                        system(overload_procedure);
1531
                        ap_log_error(APLOG_MARK, APLOG_INFO, 0,
1532
                                     ap_server_conf,
1533
                                     "external OverLoad Procedure %s launched",
1534
                                     overload_procedure);
1535
                        exit(1);
1536
                    }
1537
                }
1525
            }
1538
            }
1526
            idle_spawn_rate = 1;
1539
            idle_spawn_rate = 1;
1527
        }
1540
        }
Lines 1555-1560 Link Here
1555
    }
1568
    }
1556
    else {
1569
    else {
1557
      idle_spawn_rate = 1;
1570
      idle_spawn_rate = 1;
1571
      if (reported) {
1572
          ap_log_error(APLOG_MARK, APLOG_INFO, 0,
1573
          ap_server_conf,
1574
          "back to normal load state");
1575
      }
1576
      reported = 0;
1558
    }
1577
    }
1559
}
1578
}
1560
1579
Lines 2228-2233 Link Here
2228
    return NULL;
2247
    return NULL;
2229
}
2248
}
2230
2249
2250
static const char *set_overload_procedure(cmd_parms *cmd, void *dummy,
2251
                                         const char *arg)
2252
{
2253
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
2254
    if (err != NULL) {
2255
        return err;
2256
    }
2257
    if (strlen(arg) > MAX_OVLP_LINE-1) {
2258
        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
2259
                     "WARNING: OverLoadProcedure Definition Line too long -> OverLoadProcedure not set");
2260
        return err;
2261
    }
2262
2263
    strcpy(overload_procedure,arg);
2264
    return NULL;
2265
}
2266
2231
static const command_rec worker_cmds[] = {
2267
static const command_rec worker_cmds[] = {
2232
UNIX_DAEMON_COMMANDS,
2268
UNIX_DAEMON_COMMANDS,
2233
LISTEN_COMMANDS,
2269
LISTEN_COMMANDS,
Lines 2245-2250 Link Here
2245
  "Maximum number of child processes for this run of Apache"),
2281
  "Maximum number of child processes for this run of Apache"),
2246
AP_INIT_TAKE1("ThreadLimit", set_thread_limit, NULL, RSRC_CONF,
2282
AP_INIT_TAKE1("ThreadLimit", set_thread_limit, NULL, RSRC_CONF,
2247
  "Maximum number of worker threads per child process for this run of Apache - Upper limit for ThreadsPerChild"),
2283
  "Maximum number of worker threads per child process for this run of Apache - Upper limit for ThreadsPerChild"),
2284
AP_INIT_TAKE1("OverLoadProcedure", set_overload_procedure, NULL, RSRC_CONF,
2285
  "External Program -- Runs after an OverLoad Detection"),
2248
AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
2286
AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
2249
{ NULL }
2287
{ NULL }
2250
};
2288
};

Return to bug 42216