apache / apache/servicecomb-java-chassis

微服务启动失败 -- NullPointer问题

未关闭
#4,013 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
1.9k
派生
814
平均合并
8 天 23 小时
30 天内合并 PR
1

描述

2.6.0版本,微服务在启动的时候,偶现微服务启动失败,错误日志中显示是由空指针引起的
错误日志如下
```
[2023-11-02 18:38:10.376+08:00] [INFO] [AuditLogReportTask]-[] [] | o.a.s.f.common.utils.SPIServiceUtils Found SPI service org.apache.servicecomb.core.ConsumerProvider, count=0.
[2023-11-02 18:38:10.375+08:00] [INFO] [main]-[] [] | c.h.g.notice.config.LogLevelMonitor change loglevel to [DEBUG] end
[2023-11-02 18:38:10.378+08:00] [INFO] [main]-[] [] | c.h.g.notice.config.LogLevelMonitor start to rollBack loglevel
Nov 02, 2023 6:38:12 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [101] milliseconds.
[2023-11-02 18:38:12.973+08:00] [WARN] [AuditLogReportTask]-[] [] | com.huawei.gts.operlog.LogReportTask The current registration for CSE service has not been completed, cse status: DOWN
[2023-11-02 18:38:16.120+08:00] [ERROR] [main]-[] [] | o.s.boot.SpringApplication Application run failed
java.lang.NullPointerException:
at org.apache.servicecomb.core.CseApplicationListener.onApplicationEvent(CseApplicationListener.java:90)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:114)
at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:82)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:82)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
at com.huawei.gts.notice.NoticeServiceApplication.main(NoticeServiceApplication.java:65)
```
单纯从代码中看,是在CSEApplicationListener中的 scbEngine.getProducerProviderManager().getProducerProviderList()可能出现了空指针,请问这块是否可以做一下加固?

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先阅读第 90 行的 CseApplicationListener.java,并按照堆栈跟踪中显示的启动路径进行跟踪,尤其关注记录的 CSE DOWN 状态附近。完成的标志是微服务启动路径不再因这个 NullPointerException 失败,并且通过验证覆盖了疑似的 null 状态。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, spring-boot
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。