sofa-boot
sofa-boot copied to clipboard
disable-jvm-first=true有时不生效
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:
- Project Version [e.g. SOFA-RPC 1.0.0] :sofa-boot 3.9.1
- Language Version (e.g. Go 1.13): jdk8
- OS version (e.g.
uname -a
): win10 - IDE version: idea
Additional context
Add any other context about the problem here. 其他几个配置属性应该有类似问题
有简单复现的 demo 吗?
晚点我搭个demo复现一下
有简单复现的 demo 吗?
demo https://github.com/Kunple-w/sofa-disable-jvm-first-not-work
最新版本已经优化了相关逻辑