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

unable to create new native thread
https://*.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

上一篇:php codebase生成随机数


下一篇:DDD 领域驱动设计-谈谈 Repository、IUnitOfWork 和 IDbContext 的实践(1)