java项目经常崩掉。生成hs_err_pidxx.log

度娘过后问题可能是:服务器的运行应用程序的打开文件过多导致。 需要修改ulimit -a (open files)大小。不知道如何修改,求指导。

日志大致错误:

 A fatal error has been detected by the Java Runtime Environment:

  SIGSEGV (0xb) at pc=0x00007febb4e67eb3, pid=10230, tid=0x00007febb6168700

 JRE version: Java(TM) SE Runtime Environment (8.0_281-b09) (build 1.8.0_281-b09)
 Java VM: Java HotSpot(TM) 64-Bit Server VM (25.281-b09 mixed mode linux-amd64 compressed oops)
 Problematic frame:
 V  [libjvm.so+0x912eb3]  SR_handler(int, siginfo*, ucontext*)+0x33

 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

 An error report file with more information is saved as:
 /xxx/jar/hs_err_pid10230.log

 If you would like to submit a bug report, please visit:
   http://bugreport.java.com/bugreport/crash.jsp

服务器 free -h 信息

img

服务器配置: 4核 16 GiB
运行java项目 8个(springboot + dubbo + nacos)、还有nacos 服务。
8个Java 启动参数 统一只加了 -Xmx256m

服务器 ulimit -a 信息

img

vim /etc/security/limits.conf

  • soft nofile 65535
  • hard nofile 65535

需要重新启动。