Foglight 出现错误 "java.lang.OutOfMemoryError: unable to create new native thread"

在Centos Linux下Foglight Agent Manager日志中出现如下错误信息:

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

表示需要增加操作系统的线程资源,在Foglight AM的用户下,执行下面命令,查看当前配置:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 23297
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 2048
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 14096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

主要查看 max user processes 和 open files

在 root 用户下,修改文件  /etc/security/limits.d/20-nproc.conf,参考示例如下:

*          soft    nproc     unlimited
*          soft    nofile     4096
root       soft    nproc     unlimited

 

保存,重新启动,然后 使用ulimit -a 确认修改成功。