Openvz cointainer: “mount: Cannot allocate memory”

Shazan

Renowned Member
Oct 24, 2012
23
0
66
Hello,

I am facing a weird issue.
In an OpenVZ cointainer, with CentOS 6 64 bit, I've an high number of bind and tmpfs mounts (I need them for the cPanel Apache Jailshell):

# mount | wc -l
4091

At some point, it started to refuse to mount new ones, with the following error message:

# mount -t tmpfs tmpfs /root/prova10
mount: Cannot allocate memory

I've enough free memory:
total used free shared buffers cached
Mem: 10240 9622 617 428 0 4891
-/+ buffers/cache: 4731 5509
Swap: 4096 581 3514

Also, I can't find anything weird in my beancounters (I've already tried to raise the physpages value to no avail, that is not the problem here):

Code:
# cat /proc/user_beancounters 
Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
      125:  kmemsize                267508314           1389301760           4880072704           5368709120                    0
            lockedpages                     1                   40              1310720              1310720                    0
            privvmpages               2177549              4762704  9223372036854775807  9223372036854775807                    0
            shmpages                   109650               467721  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            numproc                       228                  501  9223372036854775807  9223372036854775807                    0
            physpages                 2453371              2642623                    0              2621440                    0
            vmguarpages                     0                    0  9223372036854775807  9223372036854775807                    0
            oomguarpages              1284529              3377101  9223372036854775807  9223372036854775807                    0
            numtcpsock                     76                  729  9223372036854775807  9223372036854775807                    0
            numflock                      224                  388  9223372036854775807  9223372036854775807                    0
            numpty                          1                    2  9223372036854775807  9223372036854775807                    0
            numsiginfo                      4                  207  9223372036854775807  9223372036854775807                    0
            tcpsndbuf                 1925072             43697352  9223372036854775807  9223372036854775807                    0
            tcprcvbuf                 1323664             13434936  9223372036854775807  9223372036854775807                    0
            othersockbuf               236056             17939688  9223372036854775807  9223372036854775807                    0
            dgramrcvbuf                     0               399280  9223372036854775807  9223372036854775807                    0
            numothersock                  134                  424  9223372036854775807  9223372036854775807                    0
            dcachesize              215807838           1342643552           2440036352           2684354560                    0
            numfile                     16530                20130  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            numiptent                     532                  601  9223372036854775807  9223372036854775807                    0

I can't understand what kind of limit I've hit here and I can't find much informations about this issue online, can somebody give me some hints?

Thanks
 
I've manage to fix it.
If somebody experience the same problem, just add:

fs.ve-mount-nr = "MAX NUMBER OF MOUNT INSIDE THE COINTAINER"

to /etc/sysctl.conf on the host and update the configuration with "sysctl -p"