RICH-ATONE

报错:Caused by: java.lang.OutOfMemoryError: unable to create new native thread

可能原因大致有以下两点:

1、系统内存耗尽,无法为新线程分配内存
2、创建线程数超过了操作系统的限制

 针对问题,进行以下几点进行排查: 

①查看内存,发现内存充足

[atone@aliyun-kafka-1-60 ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            62G         40G        833M        1.6M         21G         22G
Swap:            0B          0B          0B

②top -H 查看linux服务已使用的进程数

(Threads: 10135 使用量偏高):

top - 13:47:36 up 419 days,  2:57,  3 users,  load average: 0.24, 0.33, 0.38
Threads: 10135 total,   2 running, 10133 sleeping,   0 stopped,   0 zombie
%Cpu(s):  5.8 us,  1.3 sy,  0.0 ni, 92.4 id,  0.0 wa,  0.0 hi,  0.5 si,  0.0 st
KiB Mem : 65809472 total,   809172 free, 41971560 used, 23028740 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 23165988 avail Mem 

③查看当前用户分配最大线程数:

[atone@aliyun-kafka-1-60 flume]$ ulimit -u
10240

④调整当前用户最大线程数

永久修改ulimit,需要修改/etc/security/limits.conf。
# vim /etc/security/limits.conf 

  最后问题解决,不在报错;

 

参考:修改linux系统用户最大线程数限制

解决OutOfMemoryError: unable to create new native thread问题

posted on 2023-02-14 14:53  RICH-ATONE  阅读(149)  评论(0编辑  收藏  举报

导航