linux测试环境线程问题解决

上一篇 / 下一篇  2013-11-08 17:09:09 / 个人分类:Unix/Linux

服务器出现如下问题:

 

2013-11-07 16:03:26,592 ERROR [18931075] http-8004-6 (_500_jsp.java:76) - unable to create new native thread

java.lang.OutOfMemoryError: unable to create new native thread

       at java.lang.Thread.start0(Native Method)

       at java.lang.Thread.start(Thread.java:640)

 

或者启动服务报:

/etc/profile: fork: retry: Resource temporarily unavailable

 

原因:

进程数到达最大值.ulimit -a可以查看当前系统的所有限制值,linux一般默认是1024

 

解决方法:

  /etc/security/limits.conf最后增加:

* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535

重启系统后生效,ulimit –a查看新的限制值;

 

关于nproc设置:centos6,内核版本是2.6.32.默认情况下,ulimit -u的值为1024,是/etc/security/limits.d/90-nproc.conf的值限

 

所以如果是centos6的需要如下修改:

首先在/etc/security/limits.conf中修改最大文件数

* soft nofile 102400

* hard nofile 102400

然后在/etc/security/limits.d/90-nproc.conf中修改进程数

* soft nproc 102400

* hard nproc 102400

 


TAG:

 

评分:0

我来说两句

Open Toolbar