Out of Memory - Segfaults - Ubuntu 13.04

Discussion in 'General' started by indiadamjones, Aug 2, 2014.

  1. indiadamjones

    indiadamjones Member

    Hello, my name is Adam, and I'm having a little nightmare unfolding this morning. I'll make it short. I'm having memory issues, and segfaults, and I need some help getting my server tuned up.

    I have 2G of Ram, on Ubuntu 13.04, and I've messed with about every setting, and been on every support page I could find, with no luck. My sites are loading, but it's hit or miss! I tried using APC, but have since disabled.

    I need to nail down which setting is funky, and admittedly, since this was all working pretty well, I'm a little rusty with my troubleshooting, and could use some help. I had a client complaining about slow load, and that's what started this effort to enhance the server performance, but now, I feel like I'm doing more harm than good.

    Please help me get back on top of this, and restore my server admin confidence, so I can stop bothering you guys. Also, hoping my problems might help someone with a similar issue.

    When I try to open many pages at once, I'm hitting the wall:

    Code:
    [Sat Aug 02 11:04:26 2014] [crit] mod_rewrite: could not init map cache in child
    [FATAL] failed to allocate memory
    [Sat Aug 02 11:04:26 2014] [crit] mod_rewrite: could not init map cache in child
    [FATAL] failed to allocate memory
    [Sat Aug 02 11:04:41 2014] [error] (12)Cannot allocate memory: mod_fcgid: can't run /var/www/php-fcgi-scripts/web20/.php-fcgi-starter
    [Sat Aug 02 11:04:41 2014] [warn] (12)Cannot allocate memory: mod_fcgid: spawn process /var/www/php-fcgi-scripts/web20/.php-fcgi-starter error
    
    PHP Info from console:
    # php-cgi -v
    PHP 5.4.9-4ubuntu2.4 (cgi-fcgi) (built: Dec 12 2013 04:24:50)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

    Errors :(
    Code:
    [Sat Aug 02 14:17:26 2014] [notice] child pid 10671 exit signal Segmentation fault (11)
    /dev/zero: Cannot allocate memory
    Failed creating file mapping
    PHP Fatal error:  Failed creating file mapping in Unknown on line 0
    PHP Fatal error:  XCache: Cannot create shm in Unknown on line 0
    [Sat Aug 02 14:17:31 2014] [notice] child pid 10675 exit signal Segmentation fault (11)
    [Sat Aug 02 14:18:19 2014] [notice] Graceful restart requested, doing restart
    [Sat Aug 02 14:18:19 2014] [notice] Digest: generating secret for digest authentication ...
    [Sat Aug 02 14:18:19 2014] [notice] Digest: done
    [Sat Aug 02 14:18:19 2014] [notice] FastCGI: process manager initialized (pid 10712)
    [Sat Aug 02 14:18:19 2014] [notice] mod_python: Creating 8 session mutexes based on 300 max processes and 0 max threads.
    [Sat Aug 02 14:18:19 2014] [notice] mod_python: using mutex_directory /tmp 
    [Sat Aug 02 14:18:20 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Sat Aug 02 14:18:20 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Sat Aug 02 14:18:20 2014] [notice] Apache/2.2.22 (Ubuntu) DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_fcgid/2.3.7 PHP/5.4.9-4ubuntu2.4 mod_python/3.3.1 Python/2.7.4 mod_ruby/1.2.6 Ruby/1.8.7(2012-02-08) mod_ssl/2.2.22 OpenSSL/1.0.1c configured -- resuming normal operations
    [Sat Aug 02 14:18:20 2014] [warn] long lost child came home! (pid 10650)
    [Sat Aug 02 14:18:36 2014] [notice] child pid 10726 exit signal Segmentation fault (11)
    [Sat Aug 02 14:18:36 2014] [crit] mod_rewrite: could not init map cache in child
    [FATAL] failed to allocate memory
    [Sat Aug 02 14:18:38 2014] [crit] mod_rewrite: could not init map cache in child
    Thank you kindly,
    Adam
     
    Last edited: Aug 2, 2014
  2. indiadamjones

    indiadamjones Member

    Additional Information

    This ISPConfig 3 installation serves about a dozen sites and mail, and I have amavis and clamav-daemon running, which are both memory hungry, still 2G should be able to handle this which leads me to believe it is another issue. I will posting more information here as this thread develops, and apologize for the lack of proper configuration files in the initial request for assistance.

    This is ISPConfig 3.0.0.5.4p2
    I have an info.php running here.

    Found an insightful article that seems to be talking around simliar issues here.
    Looks like I should consider using mod_php over fastCGI. Taking a closer look now. [EDIT] This article is from 5 years ago, and out of date. The fgci variables have different names these days.
     
    Last edited: Aug 2, 2014
  3. indiadamjones

    indiadamjones Member

    Stabilizing

    Well my server seems to be stabilizing, and I'll be damned if I know what fixed it, but here are a couple things I've done/noticed.

    In /etc/php5/cgi/php.ini uncommented:
    cgi.fix_pathinfo=1

    Also noticed from the ISPConfig 3 back-end.
    Server Config >> FastCGI
    FastCGI config syntax has an option to set for Apache 2.0 or Apache 2.2
    My server is running 2.2 so I chose that option, and of course a reload or restart of Apache2 is most likely required to initiate.
     
    Last edited: Aug 2, 2014
  4. indiadamjones

    indiadamjones Member

    Making Progress

    Well, an update to my situation, I added another gig of ram. It seems the server was memory faulting all over the place. This was all a little stressful, as this is a production server, but that's what I get for running my mail server and web server off the same box.

    Regardless, I discovered my own foul up sometime later. I had transmission-daemon running as a bit torrent. Removed that, and have been absorbing a lot of new information via my troubleshooting efforts.

    Now, I'm still working on this box, because it's important to my clients. Overall I would have to say if you want to run your own server it's got to be a labor of love.

    So, for this particular thread, I just wanted to update that I'm still not sure what a lot of these connections are. Looking at iftop, I have a lot of connections, and I'm wondering if I need to go over my fail2ban settings with someone, or other troubleshooting.

    Regards,
    Adam
     
    Last edited: Aug 6, 2014
  5. srijan

    srijan New Member HowtoForge Supporter

    You need to optimise the server settings, I could suggest you to Speed up Apache webserver with mod_pagespeed and memcached as mentioned in this guide.
     

Share This Page