The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

EA3 and Apache problems

Discussion in 'EasyApache' started by sehh, Dec 14, 2007.

  1. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    I used EA3 to update my old apache into the latest available version, along with PHP. My setup is: Apache 2.2, PHP 5, SuPHP and the usual php stuff (mbstring, etc).

    The build process completed without any problem and my old apache 1.3 was converted without any problem as well. Once everything was done, Apache was restarted.

    Unfortunately, all pages displayed 500 errors and the error_log shows:

    Code:
    [alert] (12)Cannot allocate memory: apr_thread_create: unable to create worker thread
    
    Since this is a VPS, i looked at the resource limits and found out that Apache takes over the entire system memory, 398MB of memory in total.

    Weird...

    Looked further into this issue, i found out that the default apache configuration does NOT load the process/thread/memory limits and runs completely unlimited with its own defaults (which are probably based on a dedicated server with lots of gigs of memory).

    Weird... since the directory /usr/local/apache/conf/extra/ contains the "httpd-mpm.conf" file which has them defined in there! So why isn't apache using those limits?

    I then edited the /usr/local/apache/conf/extra/httpd-default.conf and those values were ignored as well... hmmm

    Apparently, the generated httpd.conf is missing the lines which actually load the "extra" configuration files. I don't know why.

    So i had to manually edit my httpd.conf and add:

    Code:
    # Server-pool management (MPM specific)
    Include "/usr/local/apache/conf/extra/httpd-mpm.conf"
    
    # Various default settings
    Include "/usr/local/apache/conf/extra/httpd-default.conf"
    
    Then restarted Apache and all those memory problems went away!!

    Someone from cPanel team care to comment on this please?
     
  2. cPanelBilly

    cPanelBilly Guest

    We don't normally add these files as they are not needed. If wanted you will need to add these as you did and distill the config.
     
  3. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    not needed?

    heh, now that EA3 is in all branches, get ready for a stream of people asking why their apache eats the entire available memory of their VPS!

    using the forum search, i found several people who have already hit this issue.

    it may be a good idea to add some new documentation pages and mention these "extras", because i had to guess and do lots of "greps" before i found them.
     
  4. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    After many hours of testing, i believe the "worker" module IS NOT suitable for a VPS server because it allocates too much memory (allocated!=used memory).

    The key issue is that it allocates the memory, so your VPS will still report that you have loads of free memory but your'll be hitting your privvmpages limit (requested but unused memory).

    You'll know it when you'll see the following signs:

    Code:
    errors like: Cannot allocate memory: couldn't create child process.
    errors like: (12)Cannot allocate memory: couldn't create child process.
    your /proc/user_beancounters under "privvmpages" will raise the fail count.
    
    i managed to limit the memory usage with the following options:

    Code:
        ServerLimit            4
        ThreadLimit           20
        StartServers           1
        MaxClients            20
        MinSpareThreads        1
        MaxSpareThreads        5
        ThreadsPerChild        5
    
    unfortunately, they are too limited and then these will hit the privvmpages limit with 20 or more concurrent HTTP requests.

    i believe the only solution is to use the prefork module which has no issues with pre-allocating memory since it doesn't use threads.
    .
     
    #4 sehh, Dec 14, 2007
    Last edited: Dec 14, 2007
Loading...

Share This Page