How to Fix “AH00485: scoreboard is full, not at MaxRequestWorkers” in Apache MPM Event Module


1 views

html

The error message AH00485: scoreboard is full, not at MaxRequestWorkers occurs in Apache's MPM event module when the server's scoreboard (a shared memory segment tracking worker processes) becomes full before reaching the configured MaxRequestWorkers limit. This typically indicates a misconfiguration in your Apache threading model.

From your configuration:

<IfModule mpm_event_module>
    StartServers             2
    ThreadLimit             196
    MinSpareThreads         96
    MaxSpareThreads        192
    ThreadsPerChild         96
    MaxRequestWorkers      192
    MaxConnectionsPerChild   96
</IfModule>

The critical issue appears to be the relationship between ThreadsPerChild and MaxRequestWorkers. With 2 child processes (from StartServers) each having 96 threads, you're already at 192 threads - exactly your MaxRequestWorkers limit.

Here's a recommended configuration adjustment:

<IfModule mpm_event_module>
    StartServers             2
    ThreadLimit             256
    MinSpareThreads         25
    MaxSpareThreads        75
    ThreadsPerChild         128
    MaxRequestWorkers      256
    MaxConnectionsPerChild   10000
</IfModule>
  1. First, verify your current Apache MPM module:
  2. httpd -V | grep -i mpm
  3. Then modify your Apache configuration file (typically httpd.conf or apache2.conf):
  4. # Backup original config
    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
    
    # Edit configuration
    vim /etc/httpd/conf/httpd.conf
  5. After making changes, test your configuration:
  6. apachectl configtest
  7. Finally, gracefully restart Apache:
  8. apachectl graceful

Use these commands to monitor your new configuration:

# Check active threads
ps -eLf | grep httpd | wc -l

# Monitor server status
watch -n 1 "curl -s http://localhost/server-status | grep -E 'Busy|Idle'"

For high-traffic servers, consider these additional optimizations:

<IfModule mpm_event_module>
    AsyncRequestWorkerFactor 2
    ServerLimit 16
    ThreadsPerChild 64
    MaxRequestWorkers 1024
    ThreadStackSize 8388608
</IfModule>

Remember to adjust these values based on your server's available memory (each thread consumes about 8MB stack space by default).

If problems continue, enable debug logging:

LogLevel mpm_event:debug
LogLevel worker:debug

This will provide detailed information about thread creation and destruction in your error logs.


The Apache scoreboard is a shared memory segment that tracks worker thread status across all server processes. In your MPM Event configuration, it's hitting capacity despite having available workers. This occurs because the scoreboard has fixed slots allocated during server startup.

// Typical scoreboard structure in Apache source code
typedef struct {
    ap_scoreboard_e sb_type;
    global_score *global;
    process_score *parent;
    worker_score **servers;
    lb_score *balancers;
} ap_scoreboard_t;

Your current settings show:

  • ThreadLimit: 196
  • MaxRequestWorkers: 192
  • ThreadsPerChild: 96
  • 2 child processes (from server status)

The key issue stems from ThreadLimit being set higher than MaxRequestWorkers. The scoreboard allocates space based on ThreadLimit, while Apache tries to enforce MaxRequestWorkers as the operational limit.

Option 1: Align ThreadLimit with MaxRequestWorkers

<IfModule mpm_event_module>
    ThreadLimit 192
    MaxRequestWorkers 192
</IfModule>

Option 2: Calculate optimal values for your hardware

# Recommended formula for memory-optimized servers
MaxRequestWorkers = (Total RAM - OS overhead) / Average process size
ThreadLimit = MaxRequestWorkers + 5% buffer

For a comparable 48GB RAM server running PHP-FPM:

StartServers 4
MinSpareThreads 64
MaxSpareThreads 128
ThreadsPerChild 64
ThreadLimit 256
MaxRequestWorkers 256
ServerLimit 16

This configuration accounts for:

  • PHP-FPM's memory overhead (~80MB per process)
  • Apache's thread memory requirements (~8MB per thread)
  • 30% headroom for traffic spikes

Implement this mod_status snippet to track scoreboard usage:

<Location /server-status>
    SetHandler server-status
    ExtendedStatus On
    <RequireAny>
        Require ip 127.0.0.1
        Require host example.com
    </RequireAny>
</Location>

Combine with this shell command to monitor in real-time:

watch -n 5 "curl -s http://localhost/server-status | grep -E 'Scoreboard|requests being processed'"
  1. Verify shared memory limits with ipcs -l
  2. Check for memory leaks in PHP extensions
  3. Monitor MaxConnectionsPerChild recycling
  4. Validate thread stack sizes with ulimit -s