VPS Debian DirectAdmin out of memory

adramelech52

Verified User
Joined
Feb 28, 2011
Messages
6
Hello

This is my first post on DirectAdmin forum, after many hours of fruitless search I decided to write to you. I am not sure if I have chosen the right section on forum, which I apologize for if I did not.

I started my experience with DirectAdmin panel (user level) few years ago on shared hosting. Two weeks ago I bought VPS server with DirectAdmin license. It seems that DirectAdmin meets my needs as it is very useful. I have not used VPS before so my knowledge in this field is very limited.

I purchased VPS in the company that provided me with shared hosting.

VPS is managed by HyperVM
Disk Space 25GB
Bandwidth 100GB/M
Processor 1,5 Ghz
Guaranteed RAM 384MB
Possible Ram 768MB
(Debian 5 / Fedora 13 / Centos 5 / Suse 11 / Ubuntu 10)

I chose Debian 5 form those available, which I had encountered before.

I have installed DirectAdmin without any problems. I have played with DirectAdmin, DNS for a while. I have also added few domains and I have created few subdomains. Everything seemed to be fine in that point. Main goal of this server is to host few wordpress blogs, games forum, few business websides and also to educate.

My problem started when I installed standard wordpress blog without plugins. I logged in to newly created wordpress admin panel and to my surprise there was a Fatal error: Out of memory (allocated 16515072) (tried to allocate 19456 bytes) in ........template.php on line 46.....

All that came next was out of memory error related to many different files. I did my google search and what I found was a typical solution
like edit memory_limit php.ini or if you can not edit .htaccess or define limit in wp-config.php etc.

Surely I tested what I had to.....

My php.ini file Resource Limits section
/usr/local/lib/php.ini

; Resource Limits
max_execution_time = 30
max_input_time = 60
;max_imput_nesting_level = 64
memory_limit = 128M

I tested different variables for memory_limit even those lower ones :D
32M, 64M, 256M etc. with no results whatsoever

I contacted my VPS provider but they only advised to read about memory_limit.....................:/

Please help me
Adramelech

There are some of lists I managed to print off form console or HyperVM below:

HyperVM
Code:
Resource 	Used 	Max
Memory 	381MB 	384MB


free –m

Code:
 total       	used       free     shared    buffers     cached
Mem:           	384        	382		1          0          0               0
-/+ buffers/cache:       		 382		1
Swap:            	0

ps aux

Code:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   1984   688 ?        Ss   Feb27   0:00 init [2]
apache    3108  0.0  6.6  39572 26288 ?        S    23:32   0:00 /usr/sbin/httpd -k start -DSSL
root      3672  0.0  0.6   8172  2728 ?        Ss   23:34   0:00 sshd: root@pts/1
root      3681  0.0  0.3   2772  1520 pts/1    Ss   23:34   0:00 -bash
root      5405  0.0  0.2   2260  1116 ?        T    04:26   0:00 top -c
nobody    5858  0.0  0.0   7752   336 ?        S    02:03   0:00 /usr/local/directadmin/directadmin d
nobody    5867  0.0  0.0   7752   336 ?        S    02:03   0:00 /usr/local/directadmin/directadmin d
nobody    5871  0.0  0.0   7752   336 ?        S    02:03   0:00 /usr/local/directadmin/directadmin d
nobody    5886  0.0  0.0   7752   336 ?        S    02:03   0:00 /usr/local/directadmin/directadmin d
apache    6061  0.0  5.7  35932 22784 ?        S    12:27   0:01 /usr/sbin/httpd -k start -DSSL
apache    6094  0.0  7.8  43176 30916 ?        S    12:27   0:03 /usr/sbin/httpd -k start -DSSL
root      7221  0.0  0.2   2260  1112 ?        T    02:05   0:00 top -c
root      7400  0.0  0.2   2260  1116 pts/1    T    23:38   0:00 top -c
nobody    7654  0.0  0.0   7752   336 ?        S    19:27   0:00 /usr/local/directadmin/directadmin d
apache    7693  0.0  6.5  38280 25808 ?        S    12:29   0:01 /usr/sbin/httpd -k start -DSSL
root      7949  0.0  0.2   2496  1164 ?        S    Feb27   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=my
mysql     8010  0.0  4.7 119596 18760 ?        Sl   Feb27   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/m
apache    9842  0.0  5.8  35904 22820 ?        S    12:30   0:02 /usr/sbin/httpd -k start -DSSL
root     10031  0.0  0.0   1156   220 ?        Ss   Feb27   0:00 /usr/local/directadmin/da-popb4smtp
root     20114  0.0  0.1   1696   596 ?        Ss   Feb27   0:01 /sbin/syslogd
root     20148  0.0  0.2   5276  1040 ?        Ss   Feb27   0:00 /usr/sbin/sshd
apache   20202  0.0  6.6  39836 26016 ?        S    15:41   0:01 /usr/sbin/httpd -k start -DSSL
root     21508  0.0  0.2   2356   864 ?        Ss   Feb27   0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -sta
root     21812  0.0  0.5   8264  1968 ?        Ss   Feb27   0:00 sendmail: MTA: accepting connections
root     21843  0.0  0.2   2040   872 ?        Ss   Feb27   0:00 /usr/sbin/cron
root     23967  0.0  0.1   3516   780 ?        Ss   Feb27   0:00 /usr/sbin/dovecot
dovecot  23968  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23969  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23970  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23974  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23975  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23976  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23977  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23978  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23979  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23980  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23993  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23994  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23995  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23996  0.0  0.5   5192  2012 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23998  0.0  0.5   5192  2020 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  23999  0.0  0.5   5192  2016 ?        S    Feb27   0:00 dovecot/pop3-login
dovecot  24000  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24001  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24002  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24003  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24004  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24005  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24006  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24008  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24009  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24010  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24011  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24012  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24013  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24014  0.0  0.5   5200  2012 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24015  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24016  0.0  0.5   5200  2016 ?        S    Feb27   0:00 dovecot/imap-login
dovecot  24017  0.0  0.2   3268   952 ?        S    Feb27   0:00 dovecot/anvil [35 connections]
root     24018  0.0  0.2   3260   996 ?        S    Feb27   0:00 dovecot/log
root     24020  0.0  0.5   4600  2188 ?        S    Feb27   0:00 dovecot/config
root     24021  0.0  0.4   4036  1656 ?        S    Feb27   0:00 dovecot/auth [0 wait, 0 passdb, 0 userdb]
root     24124  0.0  2.5  22772 10036 ?        Ss   00:11   0:00 /usr/sbin/httpd -k start -DSSL
apache   24127  0.0  8.7  49708 34308 ?        S    00:11   0:06 /usr/sbin/httpd -k start -DSSL
nobody   25978  0.0  0.2   7752  1068 ?        Ss   Feb27   0:00 /usr/local/directadmin/directadmin d
bind     26227  0.0  2.6  50276 10604 ?        Ssl  Feb27   0:07 /usr/sbin/named -u bind
ftp      26301  0.0  0.2   2888  1108 ?        Ss   Feb27   0:00 proftpd: (accepting connections)
root     26592  0.0  0.2   2300   900 pts/1    R+   23:58   0:00 ps aux
apache   28352  0.0  6.0  36340 23880 ?        S    12:19   0:02 /usr/sbin/httpd -k start -DSSL
apache   28617  0.0  6.0  37364 23900 ?        S    12:19   0:03 /usr/sbin/httpd -k start -DSSL
 
Hello,

What do you mean by "possible RAM"?

We highly recommend a processor of at least 500mhz even though DirectAdmin will run on slower systems. A minimum 128 megabytes of memory is required (2+ Gig is preferred).

The fact that you're roughly only a little over 200MB higher than the required RAM as described by DirectAdmin is a problem enough. Looking at the reports you've shown us- it seems you have a lot of "dovecot" processes running. Check to make sure your mail isn't overloaded.

I would technically advise about 512+ MB of RAM minimum- my server also has Debian 5, has HyperVM, and with 1.25GB of RAM, it functions fine. Uses about 300-400MB of RAM.

You should probably get a small upgrade of RAM from your host to boost yourself up to 512MB- and if your host is only telling you to look into memory limits- they're not the greatest host.
 
it seems you are on Openvz vps. How much memory you have guaranteed for your vps?
 
I believe, that "Possible Ram 768MB' stands for burtstable memory.

Show results for

Code:
cat /proc/user_beancounters


In any case, you'd better hire somebody from these forums to optimize your VPS and running software, or upgrade your hosting package.
 
Last edited:
im not sure is related to server and/or directadmin but wordpress directly.

Saw this error on a customer of mine...
Try to check openbasedire and safe_mode from directadmin admin level for the domain having the error.

Regards
 
The "Possible Ram 768MB" means that it can burst to that usage, the only memory that he is guaranteed is 384MB. If any other VPS's on the same node are already using the "Burstable RAM" then it isn't available to your VPS. That is why you really need to buy a VPS that has enough of Guaranteed RAM to support your typical daily spikes. The burstable RAM should be something you only use when you exceed your typical daily spike, in other words don't rely on burstable RAM, since you aren't guaranteed to ever get it.

That 128M minimum seems a little low. Since you have WordPress, you need to look at the requirements for that and add that to the DirectAdmin requirements. Some php applications require a lot of memory and if you have a busy site, it could easily gobble all available memory, especially when you may only have (384M - (memory required for OS) - (memory required by other running processes)) of memory left.

See http://wordpress.org/support/topic/how-much-memory-is-needed-to-run-wordpress
 
Just to clarify:

"Possible Ram 768MB"
Like toml said they meant burstable memory.
Guaranteed memory is 368MB like I posted before.

The wordpress I have installed has 0 traffic (new domain) and it is just a test wordpress without anything but one test post.
Each time when I hit F5 on my wordpress page HyperVM panel shows me Used memory 302, 313, 324, 334, 344, 355, 366, 377, 383 till
Fatal error: Out of memory (allocated......etc.

cat /proc/user_beancounters

Code:
Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
     1010:  kmemsize                  6722798              8212373           2147483646           2147483646                    0
            lockedpages                     0                    0               999999               999999                    0
            privvmpages                 57301                98932                98304                98304               179435
            shmpages                      797                 1453               196608               196608                    0
            dummy                           0                    0                    0                    0                    0
            numproc                        77                   89               999999               999999                    0
            physpages                   15980                57275                    0           2147483647                    0
            vmguarpages                     0                    0               196608           2147483647                    0
            oomguarpages                15980                57275               196608           2147483647                    0
            numtcpsock                     20                   31              7999992              7999992                    0
            numflock                        5                    8               999999               999999                    0
            numpty                          1                    2               500000               500000                    0
            numsiginfo                      0                   11               999999               999999                    0
            tcpsndbuf                  352408               946056            161060864            343087104                    0
            tcprcvbuf                  327680              1904472            161060864            343087104                    0
            othersockbuf               426024               724840            161060864            343087104                    0
            dgramrcvbuf                     0                10432            161060864            343087104                    0
            numothersock                  222                  238              7999992              7999992                    0
            dcachesize                      0                    0           2147483646           2147483646                    0
            numfile                      2170                 2352             23999976             23999976                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            numiptent                      14                   14               999999               999999                    0

im not sure is related to server and/or directadmin but wordpress directly.

Saw this error on a customer of mine...
Try to check openbasedire and safe_mode from directadmin admin level for the domain having the error.

Regards

Safe Mode is off, and Open BaseDir is ON, I have not changed this settings.

there is only one domain atm I am only testing it


I will try to install some other script just to test if it is wordpress related, seriously, I have no idea what to do with wordpress in this field, there was no wordpress problem on shared hosting I have (same company I bought VPS from)

Adramelech
 
See the failcounter for privvmpages 179435. Thus your VPS is short of RAM.

http://wiki.openvz.org/UBC_secondary_parameters#privvmpages

Memory allocation limit.

Privvmpages parameter allows controlling the amount of memory allocated by applications.

The barrier and the limit of privvmpages parameter control the upper boundary of the total size of allocated memory. Note that this upper boundary doesn't guarantee that the container will be able to allocate that much memory, neither does it guarantee that other containers will be able to allocate their fair share of memory. The primary mechanism to control memory allocation is the vmguarpages guarantee.

Privvmpages parameter accounts allocated (but, possibly, not used yet) memory. The accounted value is an estimation how much memory will be really consumed when the container's applications start to use the allocated memory. Consumed memory is accounted into oomguarpages parameter.

Since the memory accounted into privvmpages may not be actually used, the sum of current privvmpages values for all containers may exceed the RAM and swap size of the computer.

There should be a safety gap between the barrier and the limit for privvmpages parameter to reduce the number of memory allocation failures that the application is unable to handle. This gap will be used for “high-priority” memory allocations, such as process stack expansion. Normal priority allocations will fail when the barrier of privvmpages is reached.

Total privvmpages should correlate with the physical resources of the computer. Also, it is important not to allow any container to allocate a significant portion of all system RAM to avoid serious service level degradation for other containers. Both these configuration requirements are discussed in UBC systemwide configuration#Allocated memory.

There's also an article describing how user pages accounting works.
 
See the failcounter for privvmpages 179435. Thus your VPS is short of RAM.

http://wiki.openvz.org/UBC_secondary_parameters#privvmpages

Is there anything I can do? or only my VPS provider can fix it? What do I ask them to do, because I have no clue how to put it in short.


I have just rebooted VPS and installed phpbb3 to check if this causes the same problem the wordpress does. I have tested phpbb3 same way as I did with wordpress, so used RAM jumps from 236MB to 270MB and remains on 270MB.
Adramelech
 
Another log

./userbeans.sh

Code:
-----------------------------------------------

Processing UBC version 2.5 for VEID: 1010

Wed Mar  2 01:32:09 MSK 2011       ak

 01:32:09 up 5 min,  1 user,  load average: 0.01, 0.00, 0.00

-----------------------------------------------

 384 MB Allocation Limit [privvmpages limit]

 384 MB Allocation Barrier [privvmpages barrier]

 768 MB Allocation Guarantee [vmguarpages barrier]

 768 MB Memory Guarantee [oomguarpages barrier]

 225 MB ( 386 MB Max) page memory allocated [privvmpages held]

  53 MB ( 223 MB Max) memory + swap used [oomguarpages held]

  53 MB ( 223 MB Max) page memory used [physpages held]

2047 MB (2097151 KB) kernel memory limit [kmemsize limit]

2047 MB (2097151 KB) kernel memory barrier [kmemsize barrier]

   5 MB (  6139 KB) kernel memory used [kmemsize held]

   1 MB (  1077 KB) buffer memory used [*buf held]

-----------------------------------------------

 Used : Max_Used : Limit    for Other Resources

  2071    2445  23999976   numfile

     4       9  999999   numflock

    14      14  999999   numiptent

   226     238  7999992   numothersock

    75      89  999999   numproc

     1       2  500000   numpty

     0      16  999999   numsiginfo

    19      32  7999992   numtcpsock

-----------------------------------------------

Fail Count conditions: 1

privvmpages 57750 98932 98304 98304 179871
 
I don't know anything about your hosting provider. And you'll might be advised to upgrade VPS package, of course if you're not using any king of so called cloud VPS.

So your PHP scripts ask more RAM, than it's available. Another question is why do the do that? It might be bad settings, or some kind of a infinite loop. Or something else. There is two ways you can go, as I see the situation:

— The first, upgrade VPS package, or
— The second, find out what wrong is with your Wordpress.

About wordspress:
As it get stuck on template.php, it might be something wrong with templates/skins you're trying to use. Do you use the latest release? Default template/skin? Is both — yes. You can still try to install wordpress on another hosting or PC and then move it to your VPS. Once you' get installed wordpress on your VPS, you'll might still have the same problem with RAM.

Anyway, try it and update us with results.

p.s. That has nothing direct with directadmin at all.
 
— The second, find out what wrong is with your Wordpress.

About wordspress:
As it get stuck on template.php, it might be something wrong with templates/skins you're trying to use. Do you use the latest release? Default template/skin? Is both — yes. You can still try to install wordpress on another hosting or PC and then move it to your VPS. Once you' get installed wordpress on your VPS, you'll might still have the same problem with RAM.

I have done some tests. Error appear when there is not enough memory, no matter which part of script is in use, as it shows below the error can appear in many different scripts, I assume it is not related to wordpress but memory setup only.

Code:
FATAL ERROR: OUT OF MEMORY (ALLOCATED 15466496) (TRIED TO ALLOCATE 16 BYTES) IN /..... /WP-INCLUDES/POMO/MO.PHP ON LINE 172
FATAL ERROR: OUT OF MEMORY (ALLOCATED 10747904) (TRIED TO ALLOCATE 77824 BYTES) IN /.... /WP-INCLUDES/DEFAULT-WIDGETS.PHP ON LINE 863
FATAL ERROR: OUT OF MEMORY (ALLOCATED 17563648) (TRIED TO ALLOCATE 19456 BYTES) IN /..../WP-ADMIN/INCLUDES/UPDATE.PHP ON LINE 49
OF MEMORY (ALLOCATED 15466496) (TRIED TO ALLOCATE 19456 BYTES) IN /..../WP-ADMIN/INCLUDES/MEDIA.PHP ON LINE 27
FATAL ERROR: OUT OF MEMORY (ALLOCATED 15990784) (TRIED TO ALLOCATE 4864 BYTES) IN /..../WP-ADMIN/INCLUDES/PLUGIN.PHP ON LINE 504

Only using default skin I see the error, with any other skin it is just msg. Firefox can't find the server at...........
Adramelech
 
Thus, move to another hosting provider or upgrade existing package. I don't see any other way out.
 
Simply you need more memory. If you can get that cost effectively from your current vendor, then do it. If not, then find another vendor.

Jeff
 
Code:
root@srv:/usr/local/directadmin/custombuild# cat /proc/user_beancounters
Version: 2.5
       uid  resource                     held              maxheld                                                                                                                                                                           barrier                limit              failcnt
f8a6b362-8a59-49e5-8b04-6c49dc52ad3b: kmemsize                137474048                                                                                                                                                                         137617408  9223372036854775807  9223372036854775807                    0
            lockedpages                     0                   16  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            privvmpages               1653458              2766178  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            shmpages                     7346                 7377  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dummy                           0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numproc                       472                  472                                                                                                                                                                            131072               131072                    0
            physpages                 1629398              1664734                                                                                                                                                                           7864320              7864320                    0
            vmguarpages                     0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            oomguarpages              1629398              1664734                                                                                                                                                                                 0                    0                    0
            numtcpsock                      0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numflock                      158                  161  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numpty                          1                    1  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numsiginfo                      0                  105  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            tcpsndbuf                       0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            tcprcvbuf                       0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            othersockbuf                    0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dgramrcvbuf                     0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numothersock                    0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dcachesize               56893440             56893440  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numfile                      2304                 2765  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dummy                           0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dummy                           0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            dummy                           0                    0  922337203685                                                                                                                                                             4775807  9223372036854775807                    0
            numiptent                     362                  365                                                                                                                                                                              2000                 2000                    0
root@srv:/usr/local/directadmin/custombuild#

Memory Usage

6.32 GB of 30 GB used.
CPU Usage
0% of 4 cores used.
Storage Usage
28.24 GB of 150 GB used.
Traffic Usage
53.83 GB of 10000 GB used.

why is so high usage, hr ago was 20gb usage of memory.
 
Back
Top