部署微服务,20个服务部署到一台腾讯云服务器上. 多个项目运行一段时间均报错:
2019-11-23 16:04:19.418 INFO 19851 --- [nio-8780-exec-4] c.c.common.aspect.ControllerLogAspect : http_method : POST
2019-11-23 16:04:19.418 INFO 19851 --- [nio-8780-exec-4] c.c.common.aspect.ControllerLogAspect : ip : 10.10.64.34
2019-11-23 16:04:19.418 INFO 19851 --- [nio-8780-exec-4] c.c.common.aspect.ControllerLogAspect : class_method : com.coship.event.controller.WorkEventController.getEventLogLatest
2019-11-23 16:04:19.418 INFO 19851 --- [nio-8780-exec-4] c.c.common.aspect.ControllerLogAspect : args : [EventParam(id=null, eventCode=null, eventName=null, eventContent=null, eventLevel=null, eventStatus=null, queryStatus=null, eventType=null, isDeviceEvent=null, spCode=null, orgCode=null, sendStatus=null, createTime=null, endTime=null, assignPerson=null, isManager=0, stepId=null, remarks=null, orgCodeList=null, resourceCode=null, ruleCode=null, copyPerson=null, reviewStatus=null, imageFile=null, imageSrc=null, posterCode=null, statusAction=null, aduitPerson=null, deviceName=null, deviceCode=null, deviceAddress=null, auditResult=null, result=null, projectType=null, addrCode=null, path=null, productCode=null, productName=null, reactLogId=null, reactLogPrefix=null, isEmergency=null, isDealed=null, deviceCodeList=null), org.apache.catalina.connector.RequestFacade@2854db61]
2019-11-23 16:04:19.434 DEBUG 19851 --- [io-8780-exec-10] c.c.ws.dao.EventDao.getWoStatisByMonth : ==> Preparing: SELECT DATE_FORMAT(CREATE_TIME, '%Y-%m') statisName, COUNT(*) AS value FROM t_event WHERE t_event.sp_code = ? AND t_event.CREATE_TIME >= ? AND t_event.CREATE_TIME <= ? GROUP BY DATE_FORMAT(CREATE_TIME, '%Y-%m')
2019-11-23 16:04:19.434 DEBUG 19851 --- [io-8780-exec-10] c.c.ws.dao.EventDao.getWoStatisByMonth : ==> Parameters: SP_coship(String), 2018-12-01 00:00:00(String), 2019-11-01(String)
2019-11-23 16:04:19.435 DEBUG 19851 --- [io-8780-exec-10] c.c.ws.dao.EventDao.getWoStatisByMonth : <== Total: 0
2019-11-23 16:04:19.435 INFO 19851 --- [io-8780-exec-10] c.c.common.aspect.ControllerLogAspect : response : {"data":{"2018-12":"0","2019-01":"0","2019-02":"0","2019-03":"0","2019-04":"0","2019-05":"0","2019-06":"0","2019-07":"0","2019-08":"0","2019-09":"0","2019-10":"0","2019-11":"0"},"returnCode":"200","returnMsg":"success","success":true,"token":""}
2019-11-23 16:04:19.435 INFO 19851 --- [io-8780-exec-10] c.c.common.aspect.ControllerLogAspect : cast time : 48ms
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007ff7b5a6ae15, pid=19851, tid=140701260982016
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x858e15] LoadKlassNode::make(PhaseGVN&, Node*, Node*, TypePtr const*, TypeKlassPtr const*)+0x45
#
# Failed to write
. 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:
# /usr/local/conet/conet-parent/workorder-server/hs_err_pid19851.log
2019-11-23 16:04:19.471 INFO 19851 --- [nio-8780-exec-4] c.c.e.controller.WorkEventController : EventController getEventLogLatest() , eventReq= EventParam(id=null, eventCode=null, eventName=null, eventContent=null, eventLevel=null, eventStatus=null, queryStatus=null, eventType=null, isDeviceEvent=null, spCode=null, orgCode=null, sendStatus=null, createTime=null, endTime=null, assignPerson=null, isManager=0, stepId=null, remarks=null, orgCodeList=null, resourceCode=null, ruleCode=null, copyPerson=null, reviewStatus=null, imageFile=null, imageSrc=null, posterCode=null, statusAction=null, aduitPerson=null, deviceName=null, deviceCode=null, deviceAddress=null, auditResult=null, result=null, projectType=null, addrCode=null, path=null, productCode=null, productName=null, reactLogId=null, reactLogPrefix=null, isEmergency=null, isDealed=null, deviceCodeList=null)
2019-11-23 16:04:19.477 INFO 19851 --- [nio-8780-exec-2] c.c.common.aspect.ControllerLogAspect : url : http://10.10.64.34:8780/api/v1/getWoStatisByMonth
2019-11-23 16:04:19.477 INFO 19851 --- [nio-8780-exec-2] c.c.common.aspect.ControllerLogAspect : http_method : POST
2019-11-23 16:04:19.477 INFO 19851 --- [nio-8780-exec-2] c.c.common.aspect.ControllerLogAspect : ip : 10.10.64.34
2019-11-23 16:04:19.477 INFO 19851 --- [nio-8780-exec-2] c.c.common.aspect.ControllerLogAspect : class_method : com.coship.event.controller.WorkEventController.getWoStatisByMonth
2019-11-23 16:04:19.477 INFO 19851 --- [nio-8780-exec-2] c.c.common.aspect.ControllerLogAspect : args : [WoStatisByMonthParam(beginDate=2019-11, endDate=null, spCode=null), org.apache.catalina.connector.RequestFacade@ecc3ebc]
#
# Compiler replay data is saved as:
# /usr/local/conet/conet-parent/workorder-server/replay_pid19851.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
打出堆栈快照和线程快照均未发现问题.后修改配置完成
ulimit -a 用来显示当前的各种用户进程限制
Linux对于每个用户,系统限制其最大进程数,为提高性能,可以根据设备资源情况,
设置个Linux用户的最大进程数,一些需要设置为无限制:
数据段长度:ulimit -d unlimited
最大内存大小:ulimit -m unlimited
堆栈大小:ulimit -s unlimited
我们在用这个命令的时候主要是为了产生core文件,就是程序运行发行段错误时的文件:
#######################################################
以下来自;http://hi.baidu.com/jrckkyy/blog/item/2562320a5bdbc534b1351d95.html
查看限制情况 ulimit -a
可以看到如下信息
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 1024
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
而我们需要修改的是open files (-n) 1024的值
于是命令就是limit -n 2048(随各自需要设置)
-----------------------------------------------------------------------------------
功能说明:控制shell程序的资源。
语 法:ulimit [-aHS][-c
参考:https://www.cnblogs.com/qq78292959/archive/2012/05/08/2490443.html
网上提供的解决办法,尝试如下
[root@elastic1 logs]# ulimit -c unlimited [root@elastic1 logs]# ulimit -c -l core file size (blocks, -c) unlimited max locked memory (kbytes, -l) 64 [root@elastic1 logs]#
这里备注一下:该方法并未解决问题,希望这里不要对其他网友产生误解。
下面一篇博文提供了解决思路 https://www.cnblogs.com/songyuejie/p/11221381.html
默认情况下Linux服务起的core core file size设置为0,需要调整该参数,但是这个参数并不能 解决问题; 问题的根本原因在于服务器的运行应用程序的打开文件的最大数及最大进程数设置的相对较小默认为4096 需要修改如下配置: /etc/security/limits.conf