liunx服务器 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:48), pid=110115, tid=0x00007fb42a71f740
#
# JRE version: (8.0_144-b01) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.144-b01 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
Memory: 4k page, physical 46439204k(13383804k free), swap 0k(0k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.144-b01) for linux-amd64 JRE (1.8.0_144-b01), built on Jul 21 2017 21:57:33 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
time: Mon Jun 3 13:52:56 2024
elapsed time: 0 seconds (0d 0h 0m 0s)
查询用户的当前使用线程数
ps aux | grep museum |awk '{print $2}' | xargs -n1 pstree -p | wc -l
查看liunx给用户设置的最大使用线程数
[museum@museum-dev middleware]$ ps -u museum -L | wc -l
3963
[museum@museum-dev middleware]$
# 或者
[museum@museum-dev middleware]$ ulimit -u
得出结论线程不够用了;扩大用户的线程数
vim /etc/security/limits.d/20-nproc.conf

更新设置
# 使用 sysctl 命令:在一些情况下,你可能需要重新加载内核参数。你可以通过运行以下命令来重新加载所有参数:
bash
sudo sysctl --system
解决!!!!
作者:隔壁老郭
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
Java入门到入坟
万水千山总是情,打赏一分行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!
浙公网安备 33010602011771号