编程语言
首页 > 编程语言> > 容器内Java微服务报错:unable to create new native thread

容器内Java微服务报错:unable to create new native thread

作者:互联网

unable to create new native thread
https://stackoverflow.com/questions/16789288/java-lang-outofmemoryerror-unable-to-create-new-native-thread/16789621

不是 Java heap space 相关报错

检查当前进程数:
top -H

系统进程相关参数:
ulimit -a
每个用户都是独立,通过切换用户进行查看

启动容器报错:
starting container process caused "read init-p: connection reset by peer"

怀疑跟 pids.max 值低了有关
https://github.com/opencontainers/runc/issues/1914

查看当前值:
cat /sys/fs/cgroup/pids/kubepods/pids.current
查看配置的最大值:
cat /sys/fs/cgroup/pids/kubepods/pids.max

调整系统该配置值,
echo 327680 > /sys/fs/cgroup/pids/kubepods/pids.max
服务器配置越高,这个值可以配置越高

由于/sys/是临时文件系统,重启后会丢失,所以放在定时任务中修改:
echo '0 * * * * echo 327680 > /sys/fs/cgroup/pids/kubepods/pids.max' >> /var/spool/cron/root

标签:fs,thread,max,create,kubepods,sys,报错,cgroup,pids
来源: https://www.cnblogs.com/51core/p/15209499.html