There was a test machine this morning. When I checked with ps, I found that the command could not be executed and it returned "-bash: fork: Unable to allocate memory". Do I have to restart the
server? Suddenly I found that I connected a lot of terminals and then disconnected Open a terminal, and then you can type commands in the terminal
Simple Application Server USD1.00 New User Coupon
* Only 3,000 coupons available.
* Each new user can only get one coupon(except users from distributors).
* The coupon is valid for 30 days from the date of receipt.
There is still so much memory. . . I was speechless, and then I started typing the command again, but the problem was reported just now, "-bash: fork: unable to allocate memory", and there was a problem with another terminal connection.
[root@172.16.31.102 ~]# ssh 172.16.31.105
shell request failed on channel 0
When I saw this, I googled it. The Internet said that the kernel pid parameter of the old version of the system is relatively small (the default setting is 32768), so I want to verify that there are more terminals connected before, so there is no need to restart the
server, of course I also got lucky, and then I disconnected another terminal, here I ps a bit
Obviously, the pid number of ps is obviously close to the default pid of the kernel. Modify the kernel pid immediately and let it take effect. The command is as follows:
echo "kernel.pid_max=64000" >>/etc/sysctl.conf
sysctl -p
After it takes effect, the terminal can directly connect to this machine immediately.
To verify if this is the problem (just treat it as dead)
Find another machine, connect a few more terminals first, and then change the kernel pid to a smaller value to approximate the current maximum pid. After the change takes effect, the problem will come out and report "-bash: fork: unable to allocate memory". Find a way to change the kernel parameters quickly
Note: Some machines use the pid more seriously. If you type the command multiple times, it will report "-bash: fork: unable to allocate memory". Therefore, you can only restart the
server. If you are lucky, you can see it by typing a few more commands.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.