On a VPS run by OVH (apparently OpenVZ-based, given /proc/user_beancounters
exists), with relatively few processes running, trying to sudo
gives me the error in the title.
Here is a sample transcript:
ekleog@ekleog:~$ sudo echo a
[sudo] password for ekleog:
sudo: unable to create sockets: Cannot allocate memory
ekleog@ekleog:~$ free -h
total used free shared buffers cached
Mem: 8.0G 212M 7.8G 0B 0B 43M
-/+ buffers/cache: 168M 7.8G
Swap: 128M 0B 128M
ekleog@ekleog:~$ sudo echo a
sudo: unable to create sockets: Cannot allocate memory
As you can see, there is no problem forking, as the shell forks to run free
, but sudo
seems to be unable to open a socket. In the same domain, thunderbird is unable to open an SMTP connexion, but ssh keeps tunneling new requests without any issue.
The fact that the issue originates from too many sockets open seems confirmed by the fact that, when closing Thunderbird (which keeps something like 50 connexions to monitor all my IMAP folders) the problem vanishes. Besides, when reopening it, the issue does not prop back, so there must be a resource leak somewhere?
I am currently having a single user (me), so I hope OVH's restrictions are not that serious.
Finally, during the "crisis", I tried running netstat
(not really used to its use, so I may be wrong):
ekleog@ekleog:~$ netstat -a | wc -l
608
ekleog@ekleog:~$ cat /proc/sys/fs/file-max
1627524
It seems strange to me that sudo
would block.
Do you have any idea how to stop having this? It comes up from time to time (approx. once every other day), and is getting pretty annoying.
Apparently the problem comes from OpenVZ settings, as in /proc/user_beancounters
I have numothersock
with a huge failcnt
.
Trying to reduce the number of open sockets being dependent on each individual program, I will ask separate questions.
free -h
indicates 7.8G free, with only 212M used; is that not enough to start a process? Anyway I'll run this command next time the server starts blocking./proc/user_beancounters
exists. Updating the post to reflect this; I will also on next time it bugs have a look at the content of this file, to check whether the limits defined inside are reached.