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

image

更新设置

# 使用 sysctl 命令:在一些情况下,你可能需要重新加载内核参数。你可以通过运行以下命令来重新加载所有参数:
bash
sudo sysctl --system

解决!!!!

posted on 2024-06-03 19:27  白嫖老郭  阅读(35)  评论(0)    收藏  举报

导航