由于blade-log服务意外停止,后台错误写日志动作重复执行导致log文件瞬间爆盘

Blade 未结 0 485

一、该问题的重现步骤是什么?

1. 启动BladeX微服务

2. 停止 blade-log 服务,模拟正式环境下由于异常导致服务停止

3.访问任意带@ApiLog注解的接口


二、你期待的结果是什么?实际看到的又是什么?

访问带@ApiLog注解的接口,会自动触发写日志动作,但由于 blade-log 服务意外停止,写日志动作失败,而后,又自动触发后台错误写日志动作,该动作仍然失败,这样会导致重复触发,无限循环,本地log文件瞬间爆盘


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

BladeX 2.9.0.RELEASE Centos7

四、请提供详细的错误堆栈信息,这很重要。

java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: blade-log

at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:91)

at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:119)

at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89)

at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)

at com.sun.proxy.$Proxy190.saveErrorLog(Unknown Source)

at org.springblade.core.log.event.ErrorLogListener.saveErrorLog(ErrorLogListener.java:54)

at org.springblade.core.log.event.ErrorLogListener$$FastClassBySpringCGLIB$$da38bbb0.invoke(<generated>)

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)

at org.springblade.core.log.aspect.LogTraceAspect.around(LogTraceAspect.java:41)

at sun.reflect.GeneratedMethodAccessor161.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)

at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)

at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.interceptor.ExposeI2022-12-19 10:21:06.138 ERROR 8302 --- [   async-task-6] o.s.c.b.c.BladeExecutorConfiguration     : Unexpected exception occurred invoking async method: public void org.springblade.core.log.event.ErrorLogListener.saveErrorLog(org.springblade.core.log.event.ErrorLogEvent)

五、若有更多详细信息,请在下面提供。

解决方法

org.springblade.core.log.event.ErrorLogListener.java 

在54行增加异常捕获得到解决

try{

logService.saveErrorLog(logError);

}catch (Exception e) {

}


回答
  • 消灭零回复
提交回复