mysql中一个普通ERROR 1135 (HY000)错误引发的血案
今天接到测试人员反应,测试环境前端应用程序无连接mysql数据库,登录mysql服务器,查看错误日志,发现有如下报错:
ERROR1135(HY000):Can'tcreateanewthread(errno11);ifyouarenotoutofavailablememory,youcanconsultthemanualforapossibleOS-dependentbug
第一反应感觉可能是跟ulimit限制连接数有关,文件描述符不够用。接下来检查配置件/etc/security/limits.conf相关结果如下:
#forroot rootsoftnofile65535 roothardnofile65535 #Endoffile mysqlsoftnproc65536 mysqlhardnproc65536 mysqlsoftnofile65535 mysqlhardnofile65535
配置没有问题,mysql的ulimit限制已经打开。
但是,执行如下命令:
#sudo-urootbash-c"ulimit-a" corefilesize(blocks,-c)0 datasegsize(kbytes,-d)unlimited schedulingpriority(-e)0 filesize(blocks,-f)unlimited pendingsignals(-i)62591 maxlockedmemory(kbytes,-l)64 maxmemorysize(kbytes,-m)unlimited openfiles(-n)1024 pipesize(512bytes,-p)8 POSIXmessagequeues(bytes,-q)819200 real-timepriority(-r)0 stacksize(kbytes,-s)10240 cputime(seconds,-t)unlimited maxuserprocesses(-u)1024 virtualmemory(kbytes,-v)unlimited filelocks(-x)unlimited
发现maxuserprocesses值仍为1024.
而在Centos5里面,只须在/etc/security/limits.conf添加如下两行:
点击(此处)折叠或打开
rootsoftnofile65535
roothardnofile65535
对应的uilmit -u就会是65535.
后来猜想centos6的用户的ulimit限制是不是还有其他的配置文件做相关的限制呢?果不其然,发现在/etc/security/limits.d/目录下,有一个名为:90-nproc.conf的配置文件,
打开看看什么内容:
[root@fztest~]#cat/etc/security/limits.d/90-nproc.conf
#Defaultlimitfornumberofuser'sprocessestoprevent #accidentalforkbombs. #Seerhbz#432903forreasoning.
*softnproc1024