Results 1 to 14 of 14
  1. #1

    "bash: fork: Cannot allocate memory" error

    Hi,

    Working on CentOs 5, I got this error when listing a folder 'ls' with 5 files in it:

    PHP Code:
    root@s1 [/usr/local/lib]# ls
    -bashforkCannot allocate memory 
    What does it mean? How can I fix it?

    and my memory status is:
    PHP Code:
    root@s1 [~]# free -m
                 
    total       used       free     shared    buffers     cached
    Mem
    :         14120        224      13895          0          0          0
    -/+ buffers/cache:        224      13895
    Swap
    :            0          0          0 
    ulimit -a Output:
    PHP Code:
    core file size          (blocks, -c0
    data seg size           
    (kbytes, -dunlimited
    max nice                        
    (-e0
    file size               
    (blocks, -funlimited
    pending signals                 
    (-i88064
    max locked memory       
    (kbytes, -l32
    max memory size         
    (kbytes, -munlimited
    open files                      
    (-n1024
    pipe size            
    (512 bytes, -p8
    POSIX message queues     
    (bytes, -q819200
    max rt priority                 
    (-r0
    stack size              
    (kbytes, -s10240
    cpu time               
    (seconds, -tunlimited
    max user processes              
    (-u88064
    virtual memory          
    (kbytes, -vunlimited
    file locks                      
    (-xunlimited 
    Thank you very much in advance

  2. #2
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    1,513
    Are you on a VPS? If so, do this.

    cat /proc/user_beancounters
    tanfwc
    Singapore Managed Colocation
    Singapore BGP Announcement

  3. #3
    Yes I'm on a VPS

    here's the output:

    PHP Code:
    root@s1 [~]# cat /proc/user_beancounters
    Version2.5
           uid  resource           held    maxheld    barrier      limit    failcnt
         4057
    :  kmemsize       10329112   10329112   22111846   22754099          0
                lockedpages           0          0        512        512          0
                privvmpages      110013     110071     131072     139264     404870
                shmpages           1295       1311      43008      43008          0
                dummy                 0          0 2147483647 2147483647          0
                numproc             112        112        480        480          0
                physpages         57722      57764          0 2147483647          0
                vmguarpages           0          0      67584 2147483647          0
                oomguarpages      57723      57765 2147483647 2147483647          0
                numtcpsock           57         58        720        720          0
                numflock             11         12        376        412          0
                numpty                2          2         32         32          0
                numsiginfo            0          1        512        512          0
                tcpsndbuf        429312     476268    3440640    5406720          0
                tcprcvbuf        415492     431876    3440640    5406720          0
                othersockbuf      28368     152668    2252160    4194304          0
                dgramrcvbuf           0       8380     524288     524288          0
                numothersock         34         40        720        720          0
                dcachesize       683928     687645    7151616    7151616          0
                numfile            4063       4063      18624      18624          0
                dummy                 0          0          0          0          0
                dummy                 0          0          0          0          0
                dummy                 0          0          0          0          0
                numiptent            43         43        256        256          0 

  4. #4
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    762
    Do you see the failcnt of 404870 in your VPS privvmpages?

    Looks like you need more RAM for your VPS.
    http://wiki.openvz.org/Privvmpages#privvmpages

    Thanks.
    SecureAX Singapore - Virtualization, Private Cloud Computing & Managed Datacenter in Singapore
    - Managed Virtual Private Servers, Dedicated Servers & Colocation Services in Singapore
    - Gigabit backbone at Equinix Singapore, Telstra SGCS2 & Telin Datacenters with Private Link for Disaster Recovery setup

  5. #5
    I count, you have ~544MB RAM, you use ~429MB. you have ~110MB free. Maybe you sometimes run program, who need alocate >110MB. And, at moments when you use ls, server is using all memory.

  6. #6
    ask your VPS provider to increase the value of the variable

    privvmpages

    for your VPS
    Web Hosting Gurus

  7. #7
    Thank you for the clarification, but how is it possible that I need more RAM when I'm running one small vbulletin website on the VPS and as you can see my memory status is using 224 of 13895

  8. #8
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    1,513
    Quote Originally Posted by wir3d View Post
    Thank you for the clarification, but how is it possible that I need more RAM when I'm running one small vbulletin website on the VPS and as you can see my memory status is using 224 of 13895
    [email protected] [~]# free -m
    total used free shared buffers cached
    Mem: 14120 224 13895 0 0 0
    -/+ buffers/cache: 224 13895
    Swap: 0 0 0
    The memory allocation above does not belong to you. It belongs to the host node which also means the total memory of the machine. Are you running any control panel as well?
    tanfwc
    Singapore Managed Colocation
    Singapore BGP Announcement

  9. #9
    Join Date
    Feb 2007
    Posts
    274
    can you give us a list of processes running and we will tell you what ones are not needed that could be eating some of your ram.
    Master Reseller Accounts
    Shared Hosting
    VPS hosting
    ToastHosts.com support{at}toasthosts.com

  10. #10
    Yes I have cPanel on my VPS

    here's the list of running processes:

    PHP Code:
    root@s1 [~]# ps aux
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.0   2040   652 
    ?        Ss   Mar28   0:02 init [3]
    nobody    1764  0.0  0.0  19244  9912 ?        S    14:50   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    1787  0.0  0.0  17968  7800 
    ?        S    14:50   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    3578  0.1  0.0  22732 13112 
    ?        S    14:41   0:01 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    5537  0.1  0.0  19272 10196 
    ?        S    14:51   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    6088  0.0  0.0  17968  7804 
    ?        S    15:00   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7581  0.1  0.0  20700 11476 
    ?        S    14:52   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root      7611  0.0  0.0   8992  2704 
    ?        Ss   15:01   0:00 sshdroot@pts/1
    nobody    7818  0.0  0.0  17968  7812 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7828  0.0  0.0  17968  7792 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7829  0.0  0.0  17968  7792 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7848  1.2  0.0  19632 10276 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7849  0.0  0.0  17968  7792 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7850  0.0  0.0  17968  7792 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7851  0.0  0.0  17968  7792 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root      7863  0.2  0.0   3580  1448 pts
    /1    Ss   15:01   0:00 -bash
    nobody    7876  0.1  0.0  19824 10536 
    ?        S    14:52   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7894  0.0  0.0  20636 11364 
    ?        S    14:52   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7896  0.1  0.0  20632 11344 
    ?        S    14:52   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7921  0.2  0.0  19932 10840 
    ?        S    14:52   0:01 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7957  0.0  0.0  17968  8172 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7985  3.6  0.0  19824 10440 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    7987  1.6  0.0  19236  9900 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    8059  0.0  0.0  17968  7144 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    8095  0.0  0.0  17968  7144 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody    8097  0.0  0.0  17968  7144 
    ?        S    15:01   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root      8183  0.0  0.0   2416   908 pts
    /1    R+   15:01   0:00 ps aux
    nobody   11751  0.0  0.0  19380 10092 
    ?        S    14:53   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   11824  0.0  0.0  23280 13492 
    ?        S    14:35   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     14301  0.0  0.0   4884  1476 
    ?        S    04:22   0:00 crond
    root     14302  0.0  0.0   7472  5660 
    ?        Ss   04:22   0:01 cPanel Update (upcp) - Master
    mailnull 15371  0.0  0.0   8884  2100 
    ?        S    04:22   0:00 /usr/sbin/sendmail -FCronDaemon --odi -oem -oi -t
    root     15399  0.0  0.0   7472  4804 
    ?        Ss   04:22   0:00 cPanel Update (upcp) - Slave
    root     15401  0.0  0.0      0     0 
    ?        Z    04:22   0:00 [fixrndc] <defunct>
    nobody   15410  0.0  0.0  19388 10076 ?        S    14:54   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   15423  0.1  0.0  19252 10172 
    ?        S    14:54   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    named    15502  0.0  0.0  69036  3400 
    ?        Ssl  04:22   0:00 /usr/sbin/named -u named
    nobody   21605  0.0  0.0  19380 10104 
    ?        S    14:47   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   22239  0.1  0.0  23788 13316 
    ?        S    14:38   0:02 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   23925  0.1  0.0  19244  9940 
    ?        S    14:56   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   24542  0.1  0.0  19456 10156 
    ?        S    14:57   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     25778  0.0  0.0   8992  2700 
    ?        Ss   13:43   0:00 sshdroot@pts/0
    root     25897  0.0  0.0   3584  1456 pts
    /0    Ss+  13:44   0:00 -bash
    nobody   26007  0.3  0.0  20608 11504 
    ?        S    14:57   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   26033  0.1  0.0  20852 11592 
    ?        S    14:57   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   26034  0.1  0.0  19024  9688 
    ?        S    14:57   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   26335  0.2  0.0  19464 10160 
    ?        S    14:57   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     27985  0.0  0.0   2124   532 
    ?        S<s  Mar28   0:00 /sbin/udevd -d
    nobody   28128  0.2  0.0  20168 10868 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   28141  0.3  0.0  20084 10788 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   28186  0.1  0.1  23964 14668 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   28188  0.3  0.0  19844 10544 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     28537  0.0  0.0   1704   576 
    ?        Ss   Mar28   0:00 syslogd -m 0
    root     28555  0.0  0.0   1640   404 
    ?        S    Mar28   0:00 /usr/sbin/courierlogger -pid=/var/spool/authdaemon/pid -faci
    root     28556  0.0  0.0   1944   616 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28574  0.0  0.0   1944   236 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28575  0.0  0.0   1944   236 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28576  0.0  0.0   1944   236 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28577  0.0  0.0   1944   236 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28578  0.0  0.0   1944   236 
    ?        S    Mar28   0:00 /usr/libexec/courier-authlib/authdaemond
    root     28580  0.0  0.0   6144  1036 
    ?        Ss   Mar28   0:00 /usr/sbin/sshd
    root     28599  0.0  0.0   2684   856 
    ?        Ss   Mar28   0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
    root     28609  0.0  0.0   3580  1260 
    ?        S    Mar28   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-
    nobody   28625  0.1  0.0  20716 11624 ?        S    14:49   0:01 /usr/local/apache/bin/httpd -k start -DSSL
    mysql    28645  0.1  0.1 110396 20480 
    ?        Sl   Mar28   1:34 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user
    root     29738  0.0  0.0   8136  4720 
    ?        S    Mar28   0:00 chkservd
    root     29750  0.0  0.0   1640   404 
    ?        S    Mar28   0:00 /usr/sbin/courierlogger -pid=/var/run/imapd.pid -start -name
    root     29751  0.0  0.0   1736   540 
    ?        S    Mar28   0:00 /usr/lib/courier-imap/libexec/couriertcpd -address=-maxpro
    root     29759  0.0  0.0   1640   324 
    ?        S    Mar28   0:00 /usr/sbin/courierlogger -pid=/var/run/imapd-ssl.pid -start -
    root     29760  0.0  0.0   1740   516 ?        S    Mar28   0:00 /usr/lib/courier-imap/libexec/couriertcpd -address=-maxpro
    root     29765  0.0  0.0   1636   320 
    ?        S    Mar28   0:00 /usr/sbin/courierlogger -pid=/var/run/pop3d.pid -start -name
    root     29766  0.0  0.0   1740   512 
    ?        S    Mar28   0:00 /usr/lib/courier-imap/libexec/couriertcpd -address=-maxpro
    root     29774  0.0  0.0   1636   320 
    ?        S    Mar28   0:00 /usr/sbin/courierlogger -pid=/var/run/pop3d-ssl.pid -start -
    root     29775  0.0  0.0   1740   516 ?        S    Mar28   0:00 /usr/lib/courier-imap/libexec/couriertcpd -address=-maxpro
    mailnull 29801  0.0  0.0   8872  1092 
    ?        Ss   Mar28   0:00 /usr/sbin/exim -bd -q60m
    mailnull 29804  0.0  0.0   8876  1024 
    ?        Ss   Mar28   0:00 /usr/sbin/exim -tls-on-connect -bd -oX 465
    root     29813  0.0  0.0   4796  2052 
    ?        S    Mar28   0:03 antirelayd
    root     29991  0.0  0.2  31752 29180 
    ?        Ss   Mar28   0:02 /usr/bin/spamd ---allowed-ips=127.0.0.1 --pidfile=/var/run
    nobody   30037  0.1  0.0  19216  9908 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     30071  0.0  0.1  31752 27616 
    ?        S    Mar28   0:00 spamd child
    root     30074  0.0  0.1  31752 27536 
    ?        S    Mar28   0:00 spamd child
    root     30078  0.0  0.0  17968  8720 
    ?        Ss   Mar28   0:07 /usr/local/apache/bin/httpd -k start -DSSL
    root     30128  0.0  0.0   6212  1484 
    ?        Ss   Mar28   0:00 pure-ftpd (SERVER)
    root     30130  0.0  0.0   5980  1160 ?        S    Mar28   0:00 /usr/sbin/pure-authd -/var/run/ftpd.sock -/usr/sbin/pure
    root     30147  0.0  0.0  16516  5900 
    ?        S    Mar28   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     30148  0.0  0.0   4360  1120 
    ?        Ss   Mar28   0:00 crond
    nobody   30181  0.2  0.0  18996  9696 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    mailnull 30288  0.0  0.0   8528  5308 
    ?        S    Mar28   0:01 eximstats
    nobody   30451  0.2  0.0  19692 10396 
    ?        S    14:58   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    root     30535  0.0  0.0  19800  9076 
    ?        S    Mar28   0:00 cpsrvd waiting for connections
    root     30629  0.0  0.0  17240  9008 
    ?        S    Mar28   0:00 cpdavd accepting connections on 2077 and 2078
    root     30665  0.0  0.0   7052  4616 
    ?        S    Mar28   0:00 cpbandwd
    root     30667  0.0  0.0  15160 11856 
    ?        SN   Mar28   0:05 cpanellogd sleeping for logs
    nobody   30686  0.0  0.0   4776  2012 
    ?        S    Mar28   0:00 entropychat
    mailman  31824  0.0  0.0  10892  4884 
    ?        Ss   Mar28   0:00 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/ma
    root     31840  0.0  0.0   5436   704 
    ?        Ss   Mar28   0:00 /usr/sbin/saslauthd -/var/run/saslauthd -a pam -n 2
    root     31842  0.0  0.0   5436   432 
    ?        S    Mar28   0:00 /usr/sbin/saslauthd -/var/run/saslauthd -a pam -n 2
    mailman  31851  0.0  0.0  10724  6688 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31852  0.0  0.0  10692  6692 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31853  0.0  0.0  10668  6696 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31854  0.0  0.0  10724  6692 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31855  0.0  0.0  10712  6716 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31856  0.0  0.0  11212  7232 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31857  0.0  0.0  10728  6684 
    ?        S    Mar28   0:03 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    mailman  31859  0.0  0.0  10728  6684 
    ?        S    Mar28   0:00 /usr/bin/python2.4 /usr/local/cpanel/3rdparty/mailman/bin/qr
    root     31943  0.0  0.0   1660   424 
    ?        Ss   Mar28   0:00 /usr/sbin/portsentry -tcp
    nobody   32662  0.0  0.0  17968  8148 
    ?        S    14:59   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   32673  0.0  0.0  17968  8140 
    ?        S    14:50   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   32679  0.1  0.0  19960  9988 
    ?        S    14:59   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   32731  0.1  0.0  19632 10308 
    ?        S    14:59   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   32761  0.5  0.0  19212  9900 
    ?        S    14:59   0:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody   32762  0.2  0.0  20028 10704 
    ?        S    14:59   0:00 /usr/local/apache/bin/httpd -k start -DSSL 

  11. #11
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    1,513
    You have cPanel running which usually takes 512MB ram and you have quite a lot of web traffic as well

    Both contribute to the high memory usage
    tanfwc
    Singapore Managed Colocation
    Singapore BGP Announcement

  12. #12
    Join Date
    Dec 2005
    Posts
    3,109
    A clean cPanel install with no sites on it can be running in <200MB RAM with a little optimization.

    Based on that I would suggest looking at your Apache and MySQL configuration files in order to reduce memory usage.

  13. #13
    Join Date
    Feb 2007
    Posts
    274
    You half traffic and control panels are ram eaters, have you disabled services you dont need on the server, maybe things like ftp or exchange, also what version of apache are you running, is there a need for things like pop3 to be on and other random processes? also have you thaught about turing cpanel off via ssh and turining it back on again when you need it?
    Master Reseller Accounts
    Shared Hosting
    VPS hosting
    ToastHosts.com support{at}toasthosts.com

  14. #14
    Thank you guys for the clarification I guess I'm going to do a little optimization \ disable some services and see what comes up

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •