首先說一下環境:
centos6.3
業務環境:weiboyi
情況說明一下:
為了適應公司業務發展需要,公司新購買了一批新機器,作為weiboyi的新環境,安裝了比較新的操作系統:通統:centos6.3
一開始硬件(Dell R410)主板壞了,更換后再進行各種測試。
測試前是用root用戶啟動業務,沒有什么問題。但是后來在用非root用戶啟動時出現種問題。java報如下錯誤:
There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (gcTaskThread.cpp:46), pid=50128, tid=140649625663232
同時運行java -version也報錯
執行一個ls也會報資源暫時不足
害得我又是查看系統的/etc/security/limit.conf 又是搞/etc/sysctl.conf 然后換JDK版本等等,搞得精疲力盡,到處找相關的資料!
搞了幾天沒有搞定,今天再接着進行這方面的研究,在以前的生產環境:centos5.5下可以正常使用的系統參數時突然發現:新系統的max user processes 只有1024 而舊系統默認為278528
你M呀,問題是出在這里了,再在/etc/security/下一看。centos6多出來一個limits.d目錄,下面有個文件: 90-nproc.config
此文件內容:
# Default limit for number of user’s processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
這里限制了1024呀,果斷注釋。
再運行業務程序,問題解決!汗一下,centos6加這個搞什么呢,沒有搞清楚!
轉載自:http://tieba.baidu.com/p/2188626266