一次受限于操作系统进程数的OOM

在64bit机上跑应用,结果进程刚起来就挂,就刚起来就挂。。还OOM,还fork不出新进程,尼玛,这什么情况?

1. 如果是应用层面OOM,那么不应该任何命令都不被执行了,不应该OS直接crash掉。

2. 那么应该是OS自身的限制导致的。ulimit -a 看到限制的最大线程数是1024,这怎么够用,调大一点到1万好了 ulimit -u 10000

$ jps
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# An error report file with more information is saved as:
# /home/admin/logs/hs_err_pid26989.log

-bash: fork: 资源暂时不可用
-bash: fork: retry: 资源暂时不可用
-bash: fork: retry: 资源暂时不可用

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

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

Java HotSpot(TM) 64-Bit Server VM warning: Exception
java.lang.OutOfMemoryError occurred dispatching signal SIGTERM to handler- the VM may need to be for
cibly terminated

>$ 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) 79486
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 204800
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

原文地址:https://www.cnblogs.com/alipayhutu/p/3298360.html