Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I keep getting a memory issue on CENTOS5 which is my web-server.

 -bash: fork: Cannot allocate memory

On my website pages I get...

 Can't create a new thread (errno 12); if you are not out of available memory, you can 
 consult the   manual for a possible OS-dependent bug in /opt/lampp/htdocs/toplogin.php on line 36
 Could not connect: Can't create a new thread (errno 12); if you are not out of 
 available memory,  you can consult the manual for a possible OS-dependent bug

I have 4 gigs of memory not a ton of traffic not sure what the heck is going on...

 [root@s15433245 lampp]# ps aux
 USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 root         1  0.0  0.0  10364   748 ?        Ss   Aug03   0:16 init [3]
 postfix   1470  0.0  0.0  54224  2360 ?        S    Aug03   0:00 tlsmgr -l -t unix -u
 root      6029  0.0  0.0  46140  4184 ?        SLs  Aug31   0:00 proftpd: 74.84.118.99:3419:       USER userftp
 root     11890  0.0  0.4  69480 18808 ?        Ss   Sep02   1:50 /opt/lampp/bin/httpd -k start   -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 root     11910  0.0  0.0   9984  1412 ?        S    Sep02   0:00 /bin/sh /opt/lampp/bin/mysqld_safe --datadir=/opt/lampp/var/mysql --pid-file=/opt/lampp/var/mysql/s15433245.onli
 nobody   12177  0.0  0.3  48940 12772 ?        S    Sep02   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   12272  0.3  0.8 215536 34452 ?        Sl   Sep02  65:28 /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --plugin-dir=/opt/lampp/lib/mysql/plu
 root     13931  0.0  0.0  96588  3796 ?        Ss   08:00   0:00 sshd: root@pts/0
 root     13933  0.0  0.0  12212  1788 pts/0    Ss   08:00   0:00 -bash
 root     16321  0.0  0.0  46140  4184 ?        SLs  Sep08   0:00 proftpd: 74.84.118.99:6751: USER userftp
 root     16322  0.0  0.0  46144  4184 ?        SLs  Sep08   0:00 proftpd: 74.84.118.99:6761: USER userftp
 root     16342  0.0  0.0  46140  4184 ?        SLs  Sep08   0:00 proftpd: 74.84.118.99:6782: USER userftp
 root     16345  0.0  0.0  46136  4180 ?        SLs  Aug19   0:00 proftpd: 75.5.72.144:52094: USER userftp
 root     16346  0.0  0.0  46136  4180 ?        SLs  Aug19   0:00 proftpd: 75.5.72.144:52115: USER userftp
 root     17440  0.0  0.0  12780   772 ?        S<s  Aug03   0:00 /sbin/udevd -d
 root     17557  0.0  0.0  46136  4184 ?        SLs  Aug15   0:00 proftpd: 74.84.118.99:4172: USER userftp
 root     17559  0.0  0.0  46132  4184 ?        SLs  Aug15   0:00 proftpd: 74.84.118.99:4195: USER userftp
 nobody   19502  0.2  0.4  69984 17280 ?        S    13:56   0:01 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 root     19644  0.0  0.0   5924   624 ?        Ss   Aug03   0:52 syslogd -m 0
 root     21647  0.0  0.0  46132  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4128: USER userftp
 root     21648  0.0  0.0  46136  4188 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4140: USER userftp
  root     21749  0.0  0.0  46136  4188 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4206: USER userftp
  root     21756  0.0  0.0  46136  4188 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4234: USER userftp
  root     22095  0.0  0.0  46132  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4805: USER userftp
  root     22126  0.0  0.0  46136  4188 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:4892: USER userftp
  root     23670  0.0  0.0  46128  4176 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:6703: USER userftp
  root     23912  0.0  0.0  46132  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:6988: USER userftp
  root     23914  0.0  0.0  46128  4176 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:1365: USER userftp
  root     24011  0.0  0.0  46132  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:1396: USER userftp
 root     24015  0.0  0.0  46132  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:1421: USER userftp
 root     24033  0.0  0.0  46136  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:1438: USER userftp
 root     25900  0.0  0.0  46136  4180 ?        SLs  Aug23   0:00 proftpd: 74.84.118.99:34857: USER userftp
 root     26130  0.0  0.0  46140  4184 ?        SLs  Aug23   0:00 proftpd: 74.84.118.99:34873: USER userftp
 root     26262  0.0  0.0  46144  4188 ?        SLs  Aug23   0:00 proftpd: 74.84.118.99:34880: USER userftp
nobody   28389  0.3  0.4  70152 17416 ?        S    13:43   0:04 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 root     28399  0.0  0.0  62640  1208 ?        Ss   Aug03   1:24 /usr/sbin/sshd
 root     30128  0.0  0.0  54164  2304 ?        Ss   Aug03   0:57 /usr/libexec/postfix/master
 postfix  30153  0.0  0.0  54412  2432 ?        S    Aug03   0:06 qmgr -l -t fifo -u
 postfix  30231  0.0  0.0  54228  2264 ?        S    14:02   0:00 pickup -l -t fifo -u -c -o content_filter smtp:127.0.0.1:10027
 root     30257  0.0  0.0  20888  1188 ?        Ss   Aug03   0:15 crond
 root     30268  0.0  0.0  46752   812 ?        Ss   Aug03   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
 root     30281  0.0  0.0  46752   540 ?        S    Aug03   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
root     30324  0.0  0.0  46136  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2005: USER userftp
 root     30462  0.0  0.0  46136  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2015: USER userftp
root     30466  0.0  0.0  46136  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2083: USER userftp
 root     30471  0.0  0.0  45352  3228 ?        Ss   Aug16   0:00 proftpd: 74.84.118.99:2118: USER userftp
 root     30478  0.0  0.0  46136  4184 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2196: USER userftp
 root     30479  0.0  0.0  46132  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2249: USER userftp
 root     30485  0.0  0.0  46132  4180 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:2566: USER userftp
 root     30503  0.0  0.0  46140  4188 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:8057: USER userftp
 root     30554  0.0  0.0  46132  4184 ?        SLs  Aug12   0:00 proftpd: 74.84.118.99:3931: USER userftp
 root     30580  0.0  0.0  46128  4180 ?        SLs  Aug12   0:00 proftpd: 74.84.118.99:3994: USER userftp
 root     30683  0.0  0.0  46012  3984 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:8751: USER userftp
 root     31775  0.0  0.0  46012  3980 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9220: USER userftp
 root     31778  0.0  0.0  46016  3984 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9247: USER userftp
root     31781  0.0  0.0  46012  3980 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9266: USER root
root     31784  0.0  0.0  46016  3984 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9278: USER userftp
 root     31812  0.0  0.0  46012  3980 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9355: USER root
 root     31831  0.0  0.0  46012  3980 ?        SLs  Aug16   0:00 proftpd: 74.84.118.99:9374: USER root
 root     31967  0.0  0.0  46140  4184 ?        SLs  Aug30   0:00 proftpd: 74.84.118.99:23694: USER userftp
 nobody   31988  0.0  0.4  69852 17088 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32019  0.0  0.4  69852 17084 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32020  0.0  0.3  69480 15532 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32023  0.0  0.4  69888 17244 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32039  0.0  0.4  69852 16968 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32041  0.0  0.3  69480 15524 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32044  0.0  0.3  69480 15536 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32063  0.0  0.4  69852 17156 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32066  0.0  0.4  69852 16960 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32067  0.0  0.4  70120 17260 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32068  0.0  0.4  70120 16968 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32070  0.0  0.4  70120 17224 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32099  0.0  0.4  69744 17344 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
  nobody   32101  0.0  0.3  69612 15612 ?        S    14:03   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
  nobody   32115  0.0  0.3  69480 15500 ?        S    14:07   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
  nobody   32116  0.0  0.3  69480 15500 ?        S    14:07   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
  nobody   32117  0.0  0.0      0     0 ?        Z    14:07   0:00 [httpd] <defunct>
  nobody   32118  0.0  0.3  69480 15516 ?        S    14:07   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 nobody   32120  0.0  0.3  69480 15496 ?        S    14:07   0:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5 -E /opt/lampp/logs/error_log
 root     32122  0.0  0.0  10740   992 pts/0    R+   14:07   0:00 ps aux
  root     32512  0.0  0.0  21660   984 ?        Ss   Aug16   0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid

Mem usage

 free -m
               total       used       free     shared    buffers     cached
 Mem:          4096        362       3733          0          0          0
 -/+ buffers/cache:        362       3733

Just caught this in my logs.

 Request exceeded the limit of 10 internal redirects due to probable configuration error. Use       'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.




 core file size          (blocks, -c) 0
 data seg size           (kbytes, -d) unlimited
 scheduling priority             (-e) 0
 file size               (blocks, -f) unlimited
 pending signals                 (-i) 138240
 max locked memory       (kbytes, -l) 32
 max memory size         (kbytes, -m) unlimited
 open files                      (-n) 1024
 pipe size            (512 bytes, -p) 8
 POSIX message queues     (bytes, -q) 819200
 real-time priority              (-r) 0
 stack size              (kbytes, -s) 10240
 cpu time               (seconds, -t) unlimited
 max user processes              (-u) 138240
 virtual memory          (kbytes, -v) unlimited
 file locks                      (-x) unlimited
share|improve this question

1 Answer 1

up vote 1 down vote accepted

ulimit -a will show you resource limitations imposed on your processes. If you see anything suspicious limited, bump it up. If you want to post the output of that command here I could help further. Also check /etc/security/limits.conf.

After ulimit -a output was posted, I don't think its necessarily an OS-level problem. have you checked your apache/php configurations to see if there are any memory limits in place? Web services often have fairly strict per-thread limits so this is the next culprit I'd suspect. I don't encourage posting all your config files on here unless you're pretty confident about your security, but go check the documentation for thread/memory limits in place and hopefully you'll find your culprit.

share|improve this answer
    
Just added ulimit. Thank you. –  Andrew Threadgill Sep 15 '11 at 20:13
    
Has this solved your problem? Its much harder to give a one shot answer to server configuration problems than it is to coding problems over on stackoverflow! –  sillyMunky Sep 16 '11 at 23:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.