Closed Kunple-w closed 1 year ago
在配置com.alipay.sofa.boot.disable-jvm-first=false后,app启动完成后,真正调用时会有一些reference使用jvm,一些使用bolt.
debug发现在ReferenceRegisterHelper#registerReference注册reference时会使用SofaRuntimeProperties#isDisableJvmFirst(SofaRuntimeContext),而SofaRuntimeProperties的判断是根据内部静态变量,而内部静态变量的值的来源是SofaRuntimeConfigurationProperties,由spring回调,正常情况下该流程正常; 但是在一些场景下,如果reference的加载时间早于SofaRuntimeConfigurationProperties,这会导致ReferenceRegisterHelper中读到默认值,也就是false;而reference加载稍晚的,读取到的为true。
ReferenceRegisterHelper#registerReference
SofaRuntimeProperties#isDisableJvmFirst(SofaRuntimeContext)
SofaRuntimeConfigurationProperties
Steps to reproduce the behavior: 看了一下只有ReadinessCheckListener注入了SofaRuntimeConfigurationProperties,如果重写该bean或者不引用health包,应该会稳定复现;
ReadinessCheckListener
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
uname -a
Add any other context about the problem here. 其他几个配置属性应该有类似问题
有简单复现的 demo 吗?
晚点我搭个demo复现一下
demo https://github.com/Kunple-w/sofa-disable-jvm-first-not-work
最新版本已经优化了相关逻辑
Describe the bug
在配置com.alipay.sofa.boot.disable-jvm-first=false后,app启动完成后,真正调用时会有一些reference使用jvm,一些使用bolt.
debug发现在
ReferenceRegisterHelper#registerReference
注册reference时会使用SofaRuntimeProperties#isDisableJvmFirst(SofaRuntimeContext)
,而SofaRuntimeProperties的判断是根据内部静态变量,而内部静态变量的值的来源是SofaRuntimeConfigurationProperties
,由spring回调,正常情况下该流程正常; 但是在一些场景下,如果reference的加载时间早于SofaRuntimeConfigurationProperties,这会导致ReferenceRegisterHelper中读到默认值,也就是false;而reference加载稍晚的,读取到的为true。To Reproduce
Steps to reproduce the behavior: 看了一下只有
ReadinessCheckListener
注入了SofaRuntimeConfigurationProperties,如果重写该bean或者不引用health包,应该会稳定复现;Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
uname -a
): win10Additional context
Add any other context about the problem here. 其他几个配置属性应该有类似问题